Description:
Can you guess the output before the countdown ends?
String a = "A" + 'B' + 'C';
String b = 'A' + 'B' + "C";
System.out.println(a + " " + b);
Answer: ABC 131C
Java evaluates left to right. char + char is int math (65 + 66 = 131), but once a String is involved it concatenates.
Follow Code Snap for a new coding question every day.
#java #javaprogramming #coding #programming #codingquiz #Shorts
Share this link via
Or copy link























