Menu
Topics Index
...
`

Calling classes Constructors


If you need explanation Read this topic

If you need Answer Take test on this topic

Calling classes Constructors
Which of the following statements are valid?
public class FindValidStatement {
    public class ClassA { }
    public class ClassB { }
    public void initialize() {
        new FindValidStatement(); // STATEMENT A
        new FindValidStatement().new ClassA(); // STATEMENT B
        new FindValidStatement.ClassB();// STATEMENT C
    }
}

A. Only STATEMENT A is valid
B. STATEMENT A, B are valid
C. STATEMENT A, C are valid
D. STATEMENT A, B and C are valid
E. None
Topic: Advanced Java Programming Concepts

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.

B is the answer. ststement c is not valid as it does not contain new

Posted by Yeshu Yeshwanthi    2013-08-19 08:29:14


B is the corect answer because C is invalid because we cannot create the object of classB with out creating the object of FindValidStatement

Posted by Ram Reddy Bitla    2013-08-19 08:31:15


B is the answer

Posted by Jeeva Juliot    2013-08-19 12:22:09


ans is optn D.. here all the stmnts are valid.. stmnt A creates the object of FindValidStatement..stmnt B creates the object of ClassA and stmnt C creates the object of ClassB since the object of FindValidStatement has also been created.. the syntax of stmnt B and stmnt C are valid.

Posted by Vamsi Krishna Bulusu    2013-08-19 12:25:27


Congratulations Vamsi Bulusu. You are this dose winner. Please send us your mobile details in a private message and we will process the recharge asap.

Posted by Merit Campus    2013-08-20 03:55:11


got RC :)

Posted by Vamsi Krishna Bulusu    2013-08-21 16:03:09


yaaaaaaaaaaaaaaaaa.........party

Posted by Krishna Saradhi    2013-08-22 15:33:43


© meritcampus 2019

All Rights Reserved.

Open In App