Menu
Topics Index
...
`

Creating object for class1714


If you need explanation Read this topic

If you need Answer Take test on this topic

Creating object for class1714
What is the output of the following program?
public class VariableTest {
    static int i;
    final double d = 58.3395;
    int a;
    public static void main(String[] args) {
        VariableTest ob = new VariableTest();
        System.out.println(ob.a++ + +ob.d + ++VariableTest.i);// LINE A
    }
}

A. 58.3395
B. 60.3395
C. 59.3395
D. null
E. Compilation Error at LINE A
Topic: Static and Non Static Variables - Static and Non Static Methods

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

c. values of a=0 i=0

ob.a+ +=REMAINS 0 ONLY.!

+ +variabletest.i= increments to 1.

wen added with d the result is 59.3395

Posted by Nasir Khan    2014-09-04 03:54:01


ans e.
variable a is nt initialized.

so compilation err

Posted by Maheshwari Natarajan    2014-09-04 04:18:57


ans is e... a get default value 0,, bt static varieble i is not initialized.. so error

Posted by Raju VarshnEy    2014-09-04 04:58:30


Congratulations Nasir Khan. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-09-05 05:22:04


© meritcampus 2019

All Rights Reserved.

Open In App