Operators And Expressions

Q: What will be the output of the following program?
class Main {    
    public static void main(String args[]) {          
        double r, pi, a;       
        r = 9.8;      
        pi = 3.14;       
        a = pi * r * r;       
        System.out.println(a);    
    }   
}
A: 301.5656
Q: What will be the output of the following program?
class Main {
    public static void main(String args[]) {     
       int g = 3;
       System.out.print(++g * 8);
    } 
}
A: 32
Q: What will be the output of the following program?
class Main {
    public static void main(String[] args) {
        int a = 10;
        System.out.println(a--*a--);
    }
}
A: 90
Q: What will be the output of the following Java program?
class increment 
    {
        public static void main(String args[])
        {
            double var1 = 1 + 5; 
            double var2 = var1 / 4;
            int var3 = 1 + 5;
            int var4 = var3 / 4;
            System.out.print(var2 + " " + var4);
        } 
    }
A: 1.5 1
Q: What will be the output of the following program?
class Main {
    public static void main(String args[]) {
        int a =10;
        String b = "10";
        System.out.println(a-b);
    }
}
A: Compilation Error
Q: Predict the output for the below code:
public class CppBuzz 
{
public static void main(String[] args)
{
 int a = 10;
 System.out.println(a*a--);
}
}
A: 100
Q: What will be the output of the following program?
class Main {
    public static void main(String args[]) {
        int a =10;
        String b = "10";
        System.out.println(b+a);
    }
}
A: 1010
Q: What is the error in the following Java code?
byte b = 50;
b = b * 50;
A: * operator has converted b * 50 into int, which can not be converted to byte without casting
Q: What will the output of the given code be?
public class Main 
{
    public static void main(String[] args)
    {
     int a = 10;
     System.out.println(++a++);
    }
}
A: Compilation Error
Q: What will be the output of the given code?
public class Main {
    public static void main(String[] args) {
     int a = 10;
     System.out.println(++a*++a);
    }
}
A: 132
Q: What will the output of the given code be?
public class Main 
{
    public static void main(String[] args)
    {
      int a = 10;
      System.out.println(a++);
      a++;
    }
}
A: 10
Q: What is the output of the following code?
public class MyClass
{
public static void main(String[] args)
{
 int a = 10;
 System.out.println(a++++);
}
}
A: Compilation Error
Q: What do you mean by the ">>>" operator in Java?
A: Zero Fill Right Shift
Q: What will be the output of the following program?
class Main {
    public static void main(String[] args) {
        int a = 10;
        System.out.println(a++*a++);
    }   
}
A: 110
Q: What will be the output of the following program?
public class Main{
    public static void main(String args[]) {
           int a =10;
           String b = "-10";
           System.out.println(a+b);
    }
}
A: 10-10