What will be the output of system.out.print("Hello"+(2+5));
Answers
Answered by
1
Full códe:
public class demo {
public static void main(String[] args) {
System.out.println("Hello"+(2+5));
}
}
The output will be:
Hello7
Explanation:
- Here it will print "Hello" and the arithmetic operator "+" will add both the numbers and give the output as "Hello7".
Attachments:
Answered by
1
Actual cøde::
public class Brainly {
public static void main(String [] args) {
System.out.println("Hello" + (2 + 5));
}
}
Output will be???
Hello7
Reason : -->
==> Hello is a string and 2+5 is an operation with integer, and therefore, adding Hello with integer will result in concatenation resulting in the output to be 'Hello7'.
Remember::-
==> Always type 'S' capital in 'System.out.println'.
Attachments:
Similar questions