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

 
 

SCJP Module-3 Question-7
Posted on: July 12, 2010 at 12:00 AM
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.

Related Tags for SCJP Module-3 Question-7:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.