Q What does this sequence of statements print String msg Th

Q. What does this sequence of statements print?

String msg = “The number of characters in newCar is”;

String newCar = ”GMC”; int numberOfCharacters = newCar.length();

String carUpperCase = newCar.toUpperCase();

System.out.print(newCar);

System.out.println(carUpperCase);

System.out.print(msg);

System.out.println(newCar.length());

newCar.replace(“C”,”U”);

newCar.replace(“M”,”E”);

newCar.replace(“G”,”S”);

System.out.print(“Welcome to : ”);

System.out.println(newCar);

/*System.out.println(“Good luck”);

System.out.println(“to all students”);*/

I need the answer to be copied to Word not a picture.

Solution

String msg = \"The number of characters in newCar is\";
   String newCar = \"GMC\"; int numberOfCharacters = newCar.length();
   String carUpperCase = newCar.toUpperCase();
   System.out.print(newCar);
   System.out.println(carUpperCase);
   System.out.print(msg);
   System.out.println(newCar.length());
   newCar.replace(\"C\",\"U\");
   newCar.replace(\"M\",\"E\");
   newCar.replace(\"G\",\"S\");
   System.out.print(\"Welcome to : \");
   System.out.println(newCar);
   /*System.out.println(\"Good luck\");
   System.out.println(\"to all students\");*/

OUTPUT :

GMCGMC
The number of characters in newCar is3
Welcome to : GMC

Q. What does this sequence of statements print? String msg = “The number of characters in newCar is”; String newCar = ”GMC”; int numberOfCharacters = newCar.len

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site