Qus:    What is the output of the following Java program?
Aug 10, 2022 17:48 Java 1 Answers Views: 1117 CRYPTO REVOLT

  1. class Test   

  2. {  

  3.     public static void main (String args[])   

  4.     {  

  5.         System.out.println(10 * 20 + "Javatpoint");   

  6.         System.out.println("Javatpoint" + 10 * 20);  

  7.     }  

  8. }  

Prev Next
Answers (1)
Rao Feb 12, 2021 14:59
Answer:   he output of the above code will be

200Javatpoint
Javatpoint200
Explanation

In the first case, The numbers 10 and 20 will be multiplied first and then the result 200 is treated as the string and concatenated with the string Javatpoint to produce the output 200Javatpoint.

In the second case, The numbers 10 and 20 will be multiplied first to be 200 because the precedence of the multiplication is higher than addition. The result 200 will be treated as the string and concatenated with the string Javatpointto produce the output as Javatpoint200.

Post Your Answer
Guest User

Not sure what solution is right for you?

Choose the right one for you.
Get the help of the experts and find a solution that best suits your needs.


Let`s Connect