1. OOPS stands for
“Object Oriented Programming System”
That is, OOPS itself is not a technology, some technology or language needs to follow
the standards of in order to become Object-Oriented
14. class Parent{
}
int a=10;
int b=20;
void m1(){
System.out.println("m1");
}
class Final_Var extends Parent{
}
public static void main(String args[]){
}
Child c=new Child();
System.out.println(c.a);
System.out.println(c.b);
c.m1();
final
final
Output
10
20
m1
16. final class Parent{
}
int a=10;
int b=20;
void m1(){
System.out.println("m1");
}
class Final extends Parent{
}
public static void main(String args[]){
}
Child c=new Child();
System.out.println(c.a);
System.out.println(c.b);
c.m1();
17. Private accessibility modifier is not
allowed for a class
The only allowed accessibility
modifiers for class are
public
<default>
18. private class Parent{
}
int a=10;
int b=20;
void m1(){
System.out.println("m1");
}
class PrivateDemo extends Parent{
}
public static void main(String args[]){
}
Child c=new Child();
System.out.println(c.a);
System.out.println(c.b);
c.m1();
20. A B
C D
A A
A A A
B B
B
B
B C
C
C
C
D D
D
Singl
e
Multiple Hierarchical
Multilevel
Hybrid Multi-path
21. In any type of inheritance, if all the classes has at most one super class then that type is
in java
A
B
A
B C DC
A
B
Single
Multilevel
Hierarchical
22. A
D
B A
B C
D
A
B C
D
C
Multiple Hybrid Multi-path
In any type of inheritance, if any class has more than one super class then that type is
in java
24. When a member is accessed using subclass object , the compiler first searches In subclass , if
it is available then it should be accessed
If it is not available , then it will search in super class
If it is not available in subclass also ,then compiler gives the error
This process is known as
25. static variables and static blocks are identified
and then executed from super class to sub
class
Non-static variables, Non-static blocks and
constructors are identified and then executed
from super class to subclass
For executing method definition , searching starts from subclass to super class
Class loading order is from super class to subclass
Object creation order is also from super class to subclass
26. }
Static{
Sopln(“Super class
SB”);
}
Static{
Sopln(“Subclass SB”);
}
class Sub_Control extends
Super_Control{
Super_Control(){
Sopln(“Super
Cons”);
}
Sub_Control(){
Sopln(“Sub Cons”);
}
class Super_Control
{
{
Sopln(“Subclass
NSB”);
}
{
Sopln(“Super class
NSB”);
}
}
Public static void main(S
args[]){
sopln(“main”);
Sub_Control sb=new
Sub_Control
28. How memory is created for super class when object is created for sub-class??
With the help of
Super()
29. This process continues until java.lang.Object is reached
Constructor places super(); statement in each constructor of all the sub-classes
Automatically in compilation phase
30. class Sup1{
Sup1(){
}
}
class Sub1 extends
Sup1{
Sub1(){
}
}
class Sup1{
Sup1(){
}
}
class Sub1 extends
Sup1{
Sub1(){
}
}
compile
r
Compiles
to
super();
super();
public class Object{
public Object(){
}
}
31.
32. class First{
}
class Second extends
First{
}
compile
r
Compiles
to
class First{
}
class Second
extends First{
}
super();
First(){
}
Second(){
super();
}
33. Compiler places the default constructor , only when there is no explicit constructor in the class
But compiler places the super(); in all the constructors in a class
And super(); should be the first statement in the constructor
38. Developer should explicitly call the super class parameterized
constructor
class Sup5{
}
Class Sub5 extends Sup5{
}
Sub5(){
}
Super(20);
Sup5(int a){
System.out.println(“int-arg”);
}
public static void main(String args[]){
Sub5 sb=new Sub5();
}