Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1.  
  2. public class loopy {
  3. public static void main(String[] args) {
  4. for (int i = 100; i >= 10; i -= 5) {
  5. System.out.println(i);
  6. }
  7. }
  8. }
  9.  
  10.  
  11. import java.util.Scanner;
  12.  
  13. public class winner {
  14.  
  15. public static void checkStatus(String username) {
  16. String uppercase = username.toUpperCase();
  17.  
  18. if (uppercase.equals("SAM") || uppercase.equals("SUE")) {
  19. System.out.println("You are the winner");
  20. } else {
  21. System.out.println("Sorry, you lose");
  22. }
  23. }
  24.  
  25. public static void main(String[] args) {
  26. Scanner scanner = new Scanner(System.in);
  27. checkStatus(scanner.nextLine());
  28.  
  29. scanner.close();
  30. }
  31. }
  32.  
  33.  
  34. import java.io.Serializable;
  35.  
  36. public class Employee implements Serializable {
  37. private int employeeID = 0;
  38. private String name = "";
  39. private int salary = 0;
  40.  
  41. public Employee() {
  42. }
  43.  
  44. public int getEmployeeID() {
  45. return employeeID;
  46. }
  47.  
  48. public void setEmployeeID(int employeeID) {
  49. this.employeeID = employeeID;
  50. }
  51.  
  52. public String getName() {
  53. return name;
  54. }
  55.  
  56. public void setName(String name) {
  57. this.name = name;
  58. }
  59.  
  60. public int getSalary() {
  61. return salary;
  62. }
  63.  
  64. public void setSalary(int salary) {
  65. this.salary = salary;
  66. }
  67. }
  68.  
  69.  
  70. import java.util.ArrayList;
  71.  
  72. public class Array {
  73. public static void main(String[] args) {
  74. String[] arr = new String[3];
  75. arr[0] = "Green";
  76. arr[1] = "Red";
  77. arr[2] = "Blue";
  78.  
  79. for (String value : arr) {
  80. System.out.println(value);
  81. }
  82.  
  83. ArrayList<String> arr2 = new ArrayList<String>(5);
  84. arr2.add("Green");
  85. arr2.add("Red");
  86. arr2.add("Blue");
  87.  
  88. for (String value2 : arr2) {
  89. System.out.println(value2);
  90. }
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement