Fresh Java Classes Interview Questions & Answers:
whan we create an object so code are classname obj=new classname();classname is name of the classobj is objectnew is create new instances of class classnameso that ans is true...........what u say
2. Tell me Is it possible to declare an anonymous class while implementing an interface?
Interface i = new Interface(){/* Code}The above statement creates an instance of a class which implements the Interface "Interface". As name of class is not specified hence it is anonymous.
3. Explain what does enumeration means when talking about the 9th Amendment
Please share your answers.
4. How to call two interfaces in one interface?
You can not call 2 interface in interface but you can extend interfaces in your interface.Example :
Interface I1{..}Interface I2 extends I1{..}Interface I3 extends I2{}
When we override a method in the child class, that method sould not be a private in parent class, but that method should be public or protected or default, those methods should have the same signature.
But we can overload the method within the same class or in the child class but they have some difference in having no of arguments or type of arguments. if we overload the method within the class we can use any access specifier, if we overload in child class dont use private.
public interface Enumeration . An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.
this is called as Inner Class also
8. The methods and variables defined within a class are called members of the class
A) True
B) False
True
9. in Java, all class objects need not be dynamically allocated
A) True
B) False
I think it is true. Because, we use initalize some variables which are not dynamic.
For eg: int i = 10;
10. Static and Non-Static are the two types of nested classes
A) True
B) False
true.....class declared with static called static inner class....with out static called non static inner class..
https://InterviewQuestionsAnswers.ORG.