Home Tutorial Java Scjp Part3 SCJP Module-3 Question-4


Share on Google+Share on Google+
SCJP Module-3 Question-4
Posted on: July 12, 2010 at 12:00 AM
The example given below tests your understanding of static key word in Java and it is helpful for SCJP examination.

Given below the sample code :

class SuperClass {
SuperClass() {

static class SubClass {
SubClass() { }



Which is the correct way to declare the object of "Subclass" , which can be use outside the "Superclass" ?

1. SubClass Sub = new SuperClass().new SubClass();

2. SubClass Sub = new SuperClass.SubClass();

3. SuperClass.SubClass Sub = new SuperClass.SubClass();

Answer :


Explanation :

Because the inner class "Subclass" is declared 'static' that's why it is declared like this.


Related Tags for SCJP Module-3 Question-4:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 12, 2010

Recommend the tutorial

Advertisements Advertisements