1. Can we define a class within a constructor?
2. What will happen if we define a static nested class in a constructor?
Given: If Class A (class A has only one parametrized constructor) is the super class of B (Class B has two parametrized constructors).
3. Can we invoke the parametrized constructor of class A and the parametrized constructor of class B from the other constructor of class B.
4. What will happen if we create the object of class B:
B b1 = new B(5);
assume that there is a constructor B(int x) in class B.
2. What will happen if we define a static nested class in a constructor?
Given: If Class A (class A has only one parametrized constructor) is the super class of B (Class B has two parametrized constructors).
3. Can we invoke the parametrized constructor of class A and the parametrized constructor of class B from the other constructor of class B.
4. What will happen if we create the object of class B:
B b1 = new B(5);
assume that there is a constructor B(int x) in class B.
1.yes ,we can define a class within a constructor.
ReplyDelete3.yes ,we can invoke by using this and super keyword.
ReplyDeleteGood Post! Thank you so much for sharing the nice post, it was so good to read and useful to improve
ReplyDeleteJava Training in Electronic City