Java Operator

Last Updated :
Discuss
Comments

Question 1

What will be the output of the following expression?

Java
System.out.println(10 / 3);
  • 3

  • 3.33

  • 3.0

  • Compilation Error

Question 2

What will be the output of this Java snippet?

Java
int a = 5;
System.out.println(a++ + ++a);


  • 11

  • 12

  • 10

  • 13

Question 3

What is the result of true && false || true && true?


  • true

  • false

  • Compilation Error

  • Runtime Error

Question 4

What will be the output of this ternary operation?

Java
int a = 10, b = 20;
int min = (a < b) ? a : b;
System.out.println(min);


  • 10

  • 20

  • Compilation Error

  • Undefined Behavior

Question 5

Which operator has the highest precedence in Java?

  • + (Addition)

  • && (Logical AND)

  • * (Multiplication)

  • = (Assignment)


Question 6

Which operator is used for addition in Java?

  • +

  • ++

  • +=

  • &

Question 7

What is the result of 7 % 3 in Java?

  • 2

  • 1

  • 0

  • 3

Question 8

Which class is commonly used for taking console input in Java?


  • FileReader

  • Scanner

  • PrintWriter

  • StringReader

Question 9

Which of these is NOT a logical operator in Java?

  • &&

  • ||

  • !

  • &

There are 9 questions to complete.

Take a part in the ongoing discussion