KnowledgeBoat Logo

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