What will be displayed as a result of executing the following code? int x = 8;
String msg = "I am enjoying java.";
String msg1 = msg.toUpperCase() ;
String msg2 = msg.toLowerCase() ;
Char ltr = msg.charAt(x) ;
Int strSize = msg.length() ;
System.out.println(msg) ;
System.out.println(msg1) ;
System.out.println(msg2) ;
System.out.println("Character at index x = " +
Ltr) ;
System.out.println("msg has " + strSize +
" characters.") ;
A) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = j
Msg has 20 characters.
B) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = o
Msg has 20 characters.
C) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = o
Msg has 19 characters.
D) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = y
Msg has 19 characters.
Correct Answer:
Verified
Q16: If the compiler encounters a statement that
Q18: Class names and key words are examples
Q49: Which of the following does not describe
Q50: Which one of the following methods would
Q52: Java is a case-insensitive language.
Q53: Although the dollar sign is a legal
Q55: What will be displayed after the following
Q56: Which of the following statements correctly creates
Q58: All Java statements end with semicolons.
Q59: Named constants are initialized with a value,
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents