Home / CSE MCQs / JAVA MCQs :: Discussion

Discussion :: JAVA MCQs

  1. What is the output of this program?
    class increment {
    public static void main(String args[]) 
    {        
    int g = 3;
    System.out.print(++g * 8);
    }
  2. A.
    25
    B.
    24
    C.
    32
    D.
    33

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    Operator ++ has more preference than *, thus g becomes 4 and when multiplied by 8 gives 32.


Be The First To Comment