string array basics – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2017-01E #JAVA#4108    siteicon   siteicon  

Problem Statement - string array basics

String x[] = {“SAMSUNG”, “NOKIA”, “SONY” , “MICROMAX”, “BLACKBERRY”};
Give the output of the following statements:
i) System.out.println(x[1]);
ii) System.out.println(x[3].length());

Solution

TC++ #4108

Given Array is
String x[] = {“SAMSUNG”, “NOKIA”, “SONY” , “MICROMAX”, “BLACKBERRY”};

i) System.out.println(x[1]);
Will print NOKIA  as it is the member at index 1.

ii) System.out.println(x[3].length()); [2]
Will print 8 as member at index 3 is MICROMAX and length of this member is 8.

 


Share

sunmitra| Created: 28-Mar-2018 | Updated: 26-Nov-2019|ICSE2017









Back