public class Source { public static void main(String[] args) { Customer c1 = new Customer(1, "Sourabh", "Pune", "89", "Hello"); Customer c2 = new Customer(1, "Sourabh", "Pune", "89", "hello"); c1.setEmail("vinod@gmail.com"); c2.setEmail("vinod@gmail.com"); c2.equals(c1); Customer c3 = new Customer(); c3.setCustomerId(10); int k = c3.getCustomerId(); System.out.println(k); Customer c4 = new Customer(); c3.equals(c4); } }
String designation = "Sales"; int counter = 0, n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); String[] result = new String[n]; if (n > 0) { for (int i = 0; i < n; i++) { result[i] = sc.next(); } for (int j = 0; j < result.length; j++) { if (result[j].startsWith(designation)) { result[counter] = result[j]; counter++; } } if(counter>0){ System.out.println("Designations in Sales Department " + counter ); } else if(counter==0){ System.out.println("No designations in Sales department "); } for (int i = 0; i < counter; i++) { System.out.println(result[i]); } } else{ System.out.println("INVALID INPUT"); }
if (Arrays.stream(arr).anyMatch("sales"::equals)) { System.out.println(arr[i]); }
for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { info[i][j] = sc.nextLine(); } } for (int i = 0; i < 1; i++) { if (info[i][0].compareTo(info[i + 1][0]) > 0) { temp = info[i][0]; info[i][0] = info[i + 1][0]; info[i + 1][0] = temp; } } for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { System.out.println(info[i][j]); } }
for (int i = 0; i < 1; i++) {