Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class loopy {
- public static void main(String[] args) {
- for (int i = 100; i >= 10; i -= 5) {
- System.out.println(i);
- }
- }
- }
- import java.util.Scanner;
- public class winner {
- public static void checkStatus(String username) {
- String uppercase = username.toUpperCase();
- if (uppercase.equals("SAM") || uppercase.equals("SUE")) {
- System.out.println("You are the winner");
- } else {
- System.out.println("Sorry, you lose");
- }
- }
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- checkStatus(scanner.nextLine());
- scanner.close();
- }
- }
- import java.io.Serializable;
- public class Employee implements Serializable {
- private int employeeID = 0;
- private String name = "";
- private int salary = 0;
- public Employee() {
- }
- public int getEmployeeID() {
- return employeeID;
- }
- public void setEmployeeID(int employeeID) {
- this.employeeID = employeeID;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getSalary() {
- return salary;
- }
- public void setSalary(int salary) {
- this.salary = salary;
- }
- }
- import java.util.ArrayList;
- public class Array {
- public static void main(String[] args) {
- String[] arr = new String[3];
- arr[0] = "Green";
- arr[1] = "Red";
- arr[2] = "Blue";
- for (String value : arr) {
- System.out.println(value);
- }
- ArrayList<String> arr2 = new ArrayList<String>(5);
- arr2.add("Green");
- arr2.add("Red");
- arr2.add("Blue");
- for (String value2 : arr2) {
- System.out.println(value2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement