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

 
 

Share on Google+Share on Google+
SCJP Module-3 Question-7
Posted on: July 12, 2010 at 12:00 AM
Advertisement
In this tutorial you will test you knowledge of Inner Classes and Outer classes in Java.

Given below the sample code :

class Demo{
demo() {
}
public class Demo {
funtion() { }

}
}

How can  we correct the above code? Select appropriate option :

1.  inner class should be declare as "static"

2. inner class must also declared it's constructor.

3. change the name of the inner class.

4. no need of correction.

Answer :

 

Explanation :

An inner class can't have the same name as its enclosing class.

Advertisement

Related Tags for SCJP Module-3 Question-7:


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
 

 

 

DMCA.com