What is printed given the following int sec125 sec230 String

What is printed given the following: int sec1=25, sec2=30; String label=\"Value\"; System.out.println(label + sec1 + sec2); System.out.println(sec1 + sec2 + label); System.out.println(label + sec1 * sec2);

Solution

The output is:

Value2530

55Value

Value750

explanation:

for first statement it will not add the value and it will take it as string but for the rest two statements it will execute the integer operations.

 What is printed given the following: int sec1=25, sec2=30; String label=\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site