Computer Applications
Consider the following String array and give the output
String arr[]= {"DELHI", "CHENNAI", "MUMBAI", "LUCKNOW", "JAIPUR"};
System.out.println(arr[0].length() > arr[3].length());
System.out.print(arr[4].substring(0,3));
Java
Java String Handling
ICSE 2018
35 Likes
Answer
false
JAI
Working
As length of the string "DELHI" is less than that of "LUCKNOW" so first output is false.arr[4].substring(0,3)
will return the substring of "JAIPUR" starting at index 0 till index 2 (i.e. 3 - 1 = 2).
Answered By
22 Likes
Related Questions
Give the output of the following string functions:
"ACHIEVEMENT".replace('E', 'A')Give the output of the following string functions:
"DEDICATE".compareTo("DEVOTE")Give the output of the following statements:
String x[] = {"SAMSUNG", "NOKIA", "SONY", "MICROMAX", "BLACKBERRY"};
System.out.println(x[3].length());
Give the output of the following statements:
String x[] = {"SAMSUNG", "NOKIA", "SONY", "MICROMAX", "BLACKBERRY"};
System.out.println(x[1]);