0% found this document useful (0 votes)
2 views

Core Java 1 (Basic Questions in Java)

The document provides an overview of Java Class Loader, explaining its function in loading Java classes into memory and detailing the three built-in Class Loaders: Bootstrap, Extensions, and System Class Loaders. It also poses various fundamental questions related to Java programming concepts, such as static vs dynamic class loading, constructors vs regular methods, design patterns, and principles of Object-Oriented Programming. Additionally, it addresses key topics like inheritance, encapsulation, polymorphism, and the differences between abstract classes and interfaces.

Uploaded by

sariph.shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Core Java 1 (Basic Questions in Java)

The document provides an overview of Java Class Loader, explaining its function in loading Java classes into memory and detailing the three built-in Class Loaders: Bootstrap, Extensions, and System Class Loaders. It also poses various fundamental questions related to Java programming concepts, such as static vs dynamic class loading, constructors vs regular methods, design patterns, and principles of Object-Oriented Programming. Additionally, it addresses key topics like inheritance, encapsulation, polymorphism, and the differences between abstract classes and interfaces.

Uploaded by

sariph.shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Core J'v' 1 (B'sic

Questions in J'v')
Wh't is J'v' Cl'ss Lo'der?

We know th*t J*v* Progr*m runs on J*v* Virtu*l M*chine (JVM). When we
compile * J*v* Cl*ss, it tr*nsforms it in the form of bytecode th*t is pl*tform *nd
m*chine independent compiled progr*m *nd stores it *s * .cl*ss file. After th*t
when we try to use * Cl*ss, J*v* Cl*ssLo*der lo*ds th*t cl*ss into memory.

There *re three types of built-in Cl*ssLo*der in J*v*:


– Bootstr*p Cl*ss Lo*der – It lo*ds JDK intern*l cl*sses, typic*lly lo*ds rt.j*r
*nd other core cl*sses for ex*mple j*v*.l*ng.* p*ck*ge cl*sses
– Extensions Cl*ss Lo*der – It lo*ds cl*sses from the JDK extensions directory,
usu*lly $JAVA_HOME/lib/ext directory.
– System Cl*ss Lo*der – It lo*ds cl*sses from the current cl*ssp*th th*t c*n be
set while invoking * progr*m using -cp or -cl*ssp*th comm*nd line options.

J*v* Cl*ssLo*der is hier*rchic*l *nd whenever * request is r*ised to lo*d * cl*ss,


it deleg*tes it to its p*rent *nd in this w*y uniqueness is m*int*ined in the runtime
environment. If the p*rent cl*ss lo*der doesnʼt find the cl*ss then the cl*ss
lo*der itself tries to lo*d the cl*ss.

Expl'in st'tic vs dyn'mic cl'ss


lo'ding?
Wh't 're “st'tic initi'lizers” or “st'tic
block” with no function n'me?
Wh't is the difference between
constructors 'nd other regul'r
methods?
Wh't is builder p'ttern?
Wh't 're the 'dv'nt'ges of Object
Oriented Progr'mming L'ngu'ges?
How do you express 'n “is '”
rel'tionship 'nd “h's '” rel'tionship
or expl'in inherit'nce 'nd
composition?
Wh't is the difference between
composition 'nd 'ggreg'tion?
Wh't is polymorphism?
Wh't is inherit'nce?

Wh't is enc'psul'tion?
Wh't is the difference between
implement'tion inherit'nce 'nd
interf'ce inherit'nce with
composition?
Why would you prefer code reuse vi'
composition over inherit'nce?
Wh't is progr'mming to interf'ce?
Wh't is the difference between
'bstr'ct cl'ss 'nd interf'ce?
Wh't 're m'rker interf'ces?
Wh't is difference between method
overlo'ding 'nd method overriding?

You might also like