String x[] = {"SAMSUNG", "NOKIA", "SONY", "MICROMAX", "BLACKBERRY"};

Give the output of the following statements:

  1. System.out.println(x[1]);
  2. System.out.println(x[3].length());

Views 4

Answer:

  1. The output of System.out.println(x[1]); is NOKIA. x[1] gives the second element of the array x which is "NOKIA"

  2. The output of System.out.println(x[3].length()); is 8. x[3].length() gives the number of characters in the fourth element of the array x which is MICROMAX.

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.