Question
class operators {
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + " " + x);
}
}
What is the output of this program?
class operators {
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + " " + x);
}
}
Answer: Option D
Was this answer helpful ?
Operator ++ has higher precedence than multiplication operator, *, x is incremented to 9 than
multiplied with 3 giving 27.
output:
$ javac operators.java
$ java operators
27 9
Was this answer helpful ?
More Questions on This Topic :
Question 4.
Which of these statements are incorrect?
....
Question 5.
Which of these statements are incorrect?
....
Question 8.
Which of these statements are incorrect?
....
Submit Solution