0% found this document useful (0 votes)
10 views2 pages

Core Java Interview Questions Guide

The document summarizes core Java interview questions related to Java fundamentals like JDK, JRE, JVM, memory areas, JIT compiler, platforms, classloaders, constructors, static keyword, inheritance, polymorphism, abstraction, and encapsulation. Some key points are: - JVM runs Java bytecode and exists on various hardware/software platforms. JRE includes JVM + runtime libraries while JDK includes JRE + development tools like compilers. - JIT compiler improves performance by compiling bytecode parts with similar functionality together. - Constructors initialize object state and are invoked during object creation but cannot return a value or be inherited. - Static methods belong to the class and can access

Uploaded by

linktoanu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Core Java Interview Questions Guide

The document summarizes core Java interview questions related to Java fundamentals like JDK, JRE, JVM, memory areas, JIT compiler, platforms, classloaders, constructors, static keyword, inheritance, polymorphism, abstraction, and encapsulation. Some key points are: - JVM runs Java bytecode and exists on various hardware/software platforms. JRE includes JVM + runtime libraries while JDK includes JRE + development tools like compilers. - JIT compiler improves performance by compiling bytecode parts with similar functionality together. - Constructors initialize object state and are invoked during object creation but cannot return a value or be inherited. - Static methods belong to the class and can access

Uploaded by

linktoanu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

CoreJavaInterviewQuestions

CoreJava:BasicsofJavaInterviewQuestions
1)WhatisdifferencebetweenJDK,JREandJVM?
JVM
JVMisanacronymforJavaVirtualMachine,itisanabstractmachinewhichprovidestheruntimeenvironmentin
[Link](soJVMis
plateformdependent).
JRE
[Link].
JDK
[Link]+developmenttools.
2)HowmanytypesofmemoryareasareallocatedbyJVM?
ManyTypes:
[Link](Method)Area
[Link]
[Link]
[Link]
[Link]
3)WhatisJITcompiler?
JustInTime(JIT)compiler:[Link]
similarfunctionalityatthesametime,[Link]
compilerreferstoatranslatorfromtheinstructionsetofaJavavirtualmachine(JVM)totheinstructionset
ofaspecificCPU.
4)Whatisplatform?
[Link]
[Link].
5)WhatisthemaindifferencebetweenJavaplatformandotherplatforms?
TheJavaplatformdiffersfrommostotherplatformsinthesensethatit'sasoftwarebasedplatformthatrunson
[Link]:
[Link]
[Link](ApplicationProgrammingInterface)
6)WhatgivesJavaits'writeonceandrunanywhere'nature?
[Link]
[Link].
7)Whatisclassloader?
[Link]
[Link],Extensionclassloader,Systemclassloader,Pluginclassloaderetc.
8)[Link]?
Yes,[Link],[Link]'stakea
simpleexample:
//[Link]
classA
{
publicstaticvoidmain(Stringargs[])
{
[Link]("HelloJava!...");
}
}
//[Link]
//runbyjavaA
[Link]
runitbyjavaA
9)Isdelete,next,main,exitornullkeywordinjava?
No.
10)IfIdon'tprovideanyargumentsonthecommandline,thentheStringarrayofMainmethodwillbeemptyor
null?
[Link].
11)WhatifIwritestaticpublicvoidinsteadofpublicstaticvoid?
Programcompilesandrunsproperly.
12)Whatisthedefaultvalueofthelocalvariables?
Thelocalvariablesarenotinitializedtoanydefaultvalue,neitherprimitivesnorobjectreferences.
CoreJavaOOPsConcepts:InitialOOPsInterviewQuestions
13)Whatisdifferencebetweenobjectorientedprogramminglanguageandobjectbasedprogramminglanguage?
[Link]
programminglanguagesareJavaScript,VBScriptetc.
14)Whatwillbetheinitialvalueofanobjectreferencewhichisdefinedasaninstancevariable?
TheobjectreferencesareallinitializedtonullinJava.
CoreJavaOOPsConcepts:ConstructorInterviewQuestions
15)Whatisconstructor?
[Link]
objectcreation.
16)Whatisthepurposeofdefaultconstructor?
[Link]
constructoronlyifthereisnoconstructorintheclass.
17)Doesconstructorreturnanyvalue?
Ans:yes,thatiscurrentinstance(Youcannotusereturntypeyetitreturnsavalue).
18)Isconstructorinherited?
No,constructorisnotinherited.
19)Canyoumakeaconstructorfinal?
No,constructorcan'tbefinal.

CoreJavaOOPsConcepts:statickeywordInterviewQuestions
20)Whatisstaticvariable?
[Link](thatisnotuniqueforeachobject)e.g.
companynameofemployees,collegenameofstudentsetc.
[Link].
21)Whatisstaticmethod?
[Link].
[Link].
[Link].
22)Whymainmethodisstatic?
BecauseobjectisnotrequiredtocallstaticmethodifItwerenonstaticmethod,jvmcreatsobjectfirstthen
callmain()methodthatwillleadtotheproblemofextramemoryallocation.
23)Whatisstaticblock?
[Link].
[Link].
24)Canweexecuteaprogramwithoutmain()method?
Ans)Yes,oneofthewayisstaticblock.
25)Whatifthestaticmodifierisremovedfromthesignatureofthemainmethod?
[Link]"NoSuchMethodError".
26)Whatisdifferencebetweenstatic(class)methodandinstancemethod?
staticorclassmethod

instancemethod

1)[Link]
method.

[Link]
instancemethod.

2)Objectisnotrequiredtocallstaticmethod.

Objectisrequiredtocallinstancemethods.

3)Nonstatic(instance)memberscannotbeaccessedin
staticcontext(staticmethod,staticblockandstatic
nestedclass)directly.

staticandnonstaticvariablesbothcanbeaccessedin
instancemethods.

4)Forexample:publicstaticintcube(intn){return
n*n*n;}

Forexample:publicvoidmsg(){...}.

27)Whatisthisinjava?
Itisakeywordthatthatreferstothecurrentobject.
28)WhatisInheritance?
Inheritanceisamechanisminwhichoneobjectacquiresallthepropertiesandbehaviourofanotherobjectof
[Link].
29)Whichclassisthesuperclassforeveryclass?
Objectclass.
30)Whymultipleinheritanceisnotsupportedinjava?
Toreducethecomplexityandsimplifythelanguage,multipleinheritanceisnotsupportedinjavaincaseof
class.
31)Whatiscomposition?
Holdingthereferenceoftheotherclasswithinsomeotherclassisknownascomposition.
32)Whatisdifferencebetweenaggregationandcomposition?
[Link]:bikehas
anindicator(aggregation)butbikehasanengine(compostion).
33)WhyJavadoesnotsupportpointers?
[Link]
unsafe(unsecured)andcomplextounderstand.
34)Whatissuperinjava?
Itisakeywordthatreferstotheimmediateparentclassobject.
35)Canyouusethis()andsuper()bothinaconstructor?
[Link]()orthis()mustbethefirststatement.
36)Whatisobjectcloning?
Theobjectcloningisusedtocreatetheexactcopyofanobject.

You might also like