Tuesday, 20 May 2014

Java Operator Questions


What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int i=5,j;
        j=i++ + ++i;
        System.out.println("i="+i);
        System.out.println("j="+j);
    }
}


What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int i=5,j;
        j=i++ + ++i;
        System.out.println("i="+i);
        System.out.println("j="+j);
    }
}

What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int i=5,j;
        j=i + i++ + ++i;
        System.out.println("i="+i);
        System.out.println("j="+j);
    }
}

What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int i=5,j;
        j=i++ + i + ++i;
        System.out.println("i="+i);
        System.out.println("j="+j);
    }
}

What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int i=5,j;
        j=i++ + ++i + i;
        System.out.println("i="+i);
        System.out.println("j="+j);
    }
}

What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        double d=10;
        d=d<<2;
        System.out.println(d);
    }
}

What is the output of the following program?
lass Operators1
{
    public static void main(String[] args)
    {
        byte a=10;
        System.out.println(~a);

    }
}
What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        byte a=-20;
        System.out.println(~a);

    }
}


What is the output of the following program?
class BitWiseOps
{
    public static void main(String[] args)
    {
        int a=3, b=6;
        System.out.println((a|b) +" "+ (a&b) +" "+ (a^b));
    }
}
What is the output of the following program?
lass Operators1
{
    public static void main(String[] args)
    {
        int a=3, b=6;
    System.out.println((~a&b)|(a&~b));     
    }
}
What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int a=10, b=0;
        if( a > 10 && a/b == 10)
            System.out.println("Inside the If Condition!");
        System.out.println("Outside the If Condition!");
    }
}


What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int a=10, b=0;
        if( a == 10 && a/b == 10)
            System.out.println("Inside the If Condition!");
        System.out.println("Outside the If Condition!");
    }
}





What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int a=10, b=0;
        if( a <= 10 || a/b == 10)
            System.out.println("Inside the If Condition!");
        System.out.println("Outside the If Condition!");
    }
}
What is the output of the following program?
class Operators1
{
    public static void main(String[] args)
    {
        int a=10, b=0;
        if( a < 10 || a/b == 10)
            System.out.println("Inside the If Condition!");s
        System.out.println("Outside the If Condition!");
    }
}

No comments:

Post a Comment

Access attributes in component

NOTE: To access an attribute in a  component , use expressions as  {! v.<Attribute Name>} . ----------------------------------------...