Transcript

INTERVIEW QUESTIONS (JAVA) Prepared by SRINUVASARAO DESETTI1. What is the !st ip!rta"t #eat$re !# Ja%a&Ja%a is a p'at#!r i"depe"de"t 'a"($a(e.). What d! y!$ ea" by p'at#!r i"depe"de"*e&P'at#!r i"depe"de"*e ea"s that +e *a" +rite a"d *!pi'e the ,a%a *!de i" !"e p'at#!r (e( Wi"d!+s) a"d *a" e-e*$te the *'ass i" a"y !ther s$pp!rted p'at#!r e( (.i"$-/S!'aris/et*).0. What is a JV1&JV1 is Ja%a Virt$a' 1a*hi"e +hi*h is a r$" tie e"%ir!"e"t #!r the *!pi'ed ,a%a *'ass #i'es.2. Are JV13s p'at#!r i"depe"de"t&JV13s are "!t p'at#!r i"depe"de"t. JV13s are p'at#!r spe*i#i* r$" tie ip'ee"tati!" pr!%ided by the %e"d!r.4. What is the di##ere"*e bet+ee" a JD5 a"d a JV1&JD5 is Ja%a De%e'!pe"t 5it +hi*h is #!r de%e'!pe"t p$rp!se a"d it i"*'$des e-e*$ti!" e"%ir!"e"t a's!. 6$t JV1 is p$re'y a r$" tie e"%ir!"e"t a"d he"*e y!$ +i'' "!t be ab'e t! *!pi'e y!$r s!$r*e #i'es $si"( a JV1.7. What is a p!i"ter a"d d!es Ja%a s$pp!rt p!i"ters&P!i"ter is a re#ere"*e ha"d'e t! a e!ry '!*ati!". Ipr!per ha"d'i"( !# p!i"ters 'eads t! e!ry 'ea8s a"d re'iabi'ity iss$es he"*e Ja%a d!es"3t s$pp!rt the $sa(e !# p!i"ters.9. What is the base *'ass !# a'' *'asses&java.lang.Object:. D!es Ja%a s$pp!rt $'tip'e i"herita"*e&Ja%a d!es"3t s$pp!rt $'tip'e i"herita"*e.;. Is Ja%a a p$re !b,e*t !rie"ted 'a"($a(e&Ja%a $ses priiti%e data types a"d he"*e is "!t a p$re !b,e*t !rie"ted 'a"($a(e.1ed t! their de#a$'t %a'$es.12. ?!+ t! de#i"e a *!"sta"t %ariab'e i" Ja%a&The %ariab'e sh!$'d be de*'ared as static a"d final. S! !"'y !"e *!py !# the %ariab'e e-ists #!r a'' i"sta"*es !# the *'ass a"d the %a'$e *a"3t be *ha"(ed a's!.static final int PI = 2.14; is a" e-ap'e #!r *!"sta"t.14. Sh!$'d a ai"() eth!d be *!p$'s!ri'y de*'ared i" a'' ,a%a *'asses&N! "!t re@$ired. main() eth!d sh!$'d be de#i"ed !"'y i# the s!$r*e *'ass is a ,a%a app'i*ati!".17. What is the ret$r" type !# the ai"() eth!d&Main() eth!d d!es"3t ret$r" a"ythi"( he"*e de*'ared void.19. Why is the ai"() eth!d de*'ared stati*&main() eth!d is *a''ed by the JV1 e%e" be#!re the i"sta"tiati!" !# the *'ass he"*e it is de*'ared as static.1:. What is the ar($ee"t !# ai"() eth!d&main() eth!d a**epts a" array !# Stri"( !b,e*t as ar($ee"t.1;. =a" a ai"() eth!d be !%er'!aded&Aes. A!$ *a" ha%e a"y "$ber !# main() eth!ds +ith di##ere"t eth!d si("at$re a"d ip'ee"tati!" i" the *'ass.) &It is +ritte" ) . - / %.::. ?!+ is r!$"di"( per#!red $"der i"te(er di%isi!"&The #ra*ti!"a' part !# the res$'t is tr$"*ated. This is 8"!+" as r!$"di"( t!+ard >er!.:;. I# a *'ass is de*'ared +ith!$t a"y a**ess !di#iers/ +here ay the *'ass be a**essed&A *'ass that is de*'ared +ith!$t a"y a**ess !di#iers is said t! ha%e pa*8a(e a**ess. This ea"s that the *'ass *a" !"'y be a**essed by !ther *'asses a"d i"ter#a*es that are de#i"ed +ithi" the sae pa*8a(e.;ers *a" y!$ ha%e &As a"y as y!$ +a"t/ b$t the stati* i"itia'i>ers a"d *'ass %ariab'e i"itia'i>ers are e-e*$ted i" te-t$a' !rder a"d ay "!t re#er t! *'ass %ariab'es de*'ared i" the *'ass +h!se de*'arati!"s appear te-t$a''y a#ter the $se/ e%e" th!$(h these *'ass %ariab'es are i" s*!pe.112. What is the di##ere"*e bet+ee" eth!d !%erridi"( a"d !%er'!adi"(&O%erridi"( is a eth!d +ith the sae "ae a"d ar($e"ts as i" a pare"t/ +hereas !%er'!adi"( isthe sae eth!d "ae b$t di##ere"t ar($e"ts114. What is *!"str$*t!r *hai"i"( a"d h!+ is it a*hie%ed i" Ja%a &A *hi'd !b,e*t *!"str$*t!r a'+ays #irst "eeds t! *!"str$*t its pare"t (+hi*h i" t$r" *a''s its pare"t *!"str$*t!r.). I" Ja%a it is d!"e %ia a" ip'i*it *a'' t! the "!Bar(s *!"str$*t!r as the #irst statee"t.117. What is the di##ere"*e bet+ee" the 6!!'ea" I !perat!r a"d the II !perat!r&I# a" e-pressi!" i"%!'%i"( the 6!!'ea" I !perat!r is e%a'$ated/ b!th !pera"ds are e%a'$ated. The" the I !perat!r is app'ied t! the !pera"d. Whe" a" e-pressi!" i"%!'%i"( the II !perat!r is e%a'$ated/ the #irst !pera"d is e%a'$ated. I# the #irst !pera"d ret$r"s a %a'$e !# tr$e the" the se*!"d !pera"d is e%a'$ated. The II !perat!r is the" app'ied t! the #irst a"d se*!"d !pera"ds. I#the #irst !pera"d e%a'$ates t! #a'se/ the e%a'$ati!" !# the se*!"d !pera"d is s8ipped.119. Whi*h Ja%a !perat!r is ri(ht ass!*iati%e&The J !perat!r is ri(ht ass!*iati%e.11:. =a" a d!$b'e %a'$e be *ast t! a byte&Aes/ a d!$b'e %a'$e *a" be *ast t! a byte.11;. What is the di##ere"*e bet+ee" a brea8 statee"t a"d a *!"ti"$e statee"t&A b!ea statee"t res$'ts i" the teri"ati!" !# the statee"t t! +hi*h it app'ies (s+it*h/ #!r/ d!/ !r +hi'e). A continue statee"t is $sed t! e"d the *$rre"t '!!p iterati!" a"d ret$r" *!"tr!' t! the '!!p statee"t.1)ed&The de#a$'t %a'$e !# a" Stri"( type is "$''.1)). What is the di##ere"*e bet+ee" a #ie'd %ariab'e a"d a '!*a' %ariab'e&A #ie'd %ariab'e is a %ariab'e that is de*'ared as a eber !# a *'ass. A '!*a' %ariab'e is a %ariab'e that is de*'ared '!*a' t! a eth!d.1)0. ?!+ are this() a"d s$per() $sed +ith *!"str$*t!rs&t$is() is $sed t! i"%!8e a *!"str$*t!r !# the sae *'ass. supe!() is $sed t! i"%!8e a s$per*'ass *!"str$*t!r.1)2. What d!es it ea" that a *'ass !r eber is #i"a'&A #i"a' *'ass *a""!t be i"herited. A #i"a' eth!d *a""!t be !%erridde" i" a s$b*'ass. A #i"a' #ie'd *a""!t be *ha"(ed a#ter it3s i"itia'i>ed/ a"d it $st i"*'$de a" i"itia'i>er statee"t +here it3s de*'ared.1)4. What d!es it ea" that a eth!d !r *'ass is abstra*t&A" abstra*t *'ass *a""!t be i"sta"tiated. Abstra*t eth!ds ay !"'y be i"*'$ded i" abstra*t *'asses. ?!+e%er/ a" abstra*t *'ass is "!t re@$ired t! ha%e a"y abstra*t eth!ds/ th!$(h !st !# the d!. Ea*h s$b*'ass !# a" abstra*t *'ass $st !%erride the abstra*t eth!ds !# its s$per*'asses!r it a's! sh!$'d be de*'ared abstra*t.1)7. What is a tra"sie"t %ariab'e&Tra"sie"t %ariab'e is a %ariab'e that ay "!t be seria'i>ed.1)9. ?!+ d!es Ja%a ha"d'e i"te(er !%er#'!+s a"d $"der#'!+s&It $ses th!se '!+ !rder bytes !# the res$'t that *a" #it i"t! the si>e !# the type a''!+ed by the !perati!".1):. What is the di##ere"*e bet+ee" the KK a"d KKK !perat!rs&The KK !perat!r *arries the si(" bit +he" shi#ti"( ri(ht. The KKK >er!B#i''s bits that ha%e bee" shi#ted !$t.1);. Is si>e!# a 8ey+!rd&The si>e!# !perat!r is "!t a 8ey+!rd.


Recommended