41.
What will be the output for the below code?
class A{
      public void printValue(){
            System.out.println("A");
      }
}
class B extends A{
      public void printValue(){
            System.out.println("B");
      }
}

public class Test{
      public static void main(String... args){
            A b = new B();
            newValue(b);
      }
      public static void newValue(A a){
            if(a instanceof B){
                  ((B)a).printValue();
            }
      }
}

42.
Determine output:
public class Test{
      static int i = 5;
      public static void main(String... args){
            System.out.println(i++);
            System.out.println(i);
            System.out.println(++i);
            System.out.println(++i+i++);
      }
}

43.
What will be the output of the following Java code?
class operators 
{
    public static void main(String args[])
    {
        int var1 = 5; 
        int var2 = 6;
        int var3;
        var3 = ++ var2 * var1 / var2 + var2;
        System.out.print(var3);
    } 
}

48.
What will be the output of the following Java program?
class jump_statments 
{
    public static void main(String args[]) 
    {        
         int x = 2;
         int y = 0;
         for ( ; y < 10; ++y) 
         {
             if (y % x == 0) 
                 continue;  
             else if (y == 8)
                  break;
             else
                System.out.print(y + " ");
         }
    } 
}

50.
What will be the output of the following Java program?
class leftshift_operator 
{
    public static void main(String args[]) 
    {        
         byte x = 64;
         int i;
         byte y; 
         i = x << 2;
         y = (byte) (x << 2)
         System.out.print(i + " " + y);
    } 
}

Read More Section(Operators)

Each Section contains maximum 100 MCQs question on Operators. To get more questions visit other sections.