Java Operator

Last Updated :
Discuss
Comments

Question 1

What will be the output of the following expression?

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

    3

  • B

    3.33

  • C

    3.0

  • D

    Compilation Error

Question 2

What will be the output of this Java snippet?

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


  • A

    11

  • B

    12

  • C

    10

  • D

    13

Question 3

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


  • A

    true

  • B

    false

  • C

    Compilation Error

  • D

    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);


  • A

    10

  • B

    20

  • C

    Compilation Error

  • D

    Undefined Behavior

Question 5

Which operator has the highest precedence in Java?

  • A

    + (Addition)

  • B

    && (Logical AND)

  • C

    * (Multiplication)

  • D

    = (Assignment)


Question 6

Which operator is used for addition in Java?

  • A

    +

  • B

    ++

  • C

    +=

  • D

    &

Question 7

What is the result of 7 % 3 in Java?

  • A

    2

  • B

    1

  • C

    0

  • D

    3

Question 8

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


  • A

    FileReader

  • B

    Scanner

  • C

    PrintWriter

  • D

    StringReader

Question 9

Which of these is NOT a logical operator in Java?

  • A

    &&

  • B

    ||

  • C

    !

  • D

    &

There are 9 questions to complete.

Take a part in the ongoing discussion