Friday, 6 December 2019

What will the following code fragment printout?

What will the following code fragment printout? 
String myString = "Java": System.out.println(myString.toUppercase() + "or" + myString): 
 A. java or Java 
B. Java or Java 
C. JAVA or JAVA 
D. JAVA or Java

Solution:

 
D (JAVA or Java)

The below program has two varints the first variant which converts all characters in the string to upper case and second variant takes locale as argument and converts into upper case

No comments:

Post a Comment