Tuesday, 20 May 2014

Java Operators Questions


What is the output of the following program?
class ModulusOperators1
{
    public static void main(String[] args)
    {
        double d=2.8;
        System.out.println("2.8%1.2 ="+ d%1.2);
    }
}

A.
0.4

B.
Compilation Error

C.
0

D.
None of the Above


What is the output of thefollowing program?
class Operators1
{
    public static void main(String[] args)
    {
        double x=6;
        int y=5,z=2;
        x= y++ + ++x/z;
        System.out.println(x);
    }
}

A.
9

B.
8

C.
8.5

D.
None of the Above

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



A.
15

B.
35

C.
Compilation Error

D.
None of the Above

What is the output of the following program?
class Class1
{
}
class Operators1
{
    public static void main(String[] args)
    {
        Class1 myobj= new Class1();
        System.out.println(myobj instanceof Operators1);
    }
}

A.
True

B.
False

C.
Compilation Error

D.
None of the Above

No comments:

Post a Comment

Access attributes in component

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