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

Basic Java Interview Questions1234

Basic Java Interview Questions1234

Uploaded by

madhu_devu9837
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)
57 views2 pages

Basic Java Interview Questions1234

Basic Java Interview Questions1234

Uploaded by

madhu_devu9837
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

Basic Java interview questions

1. What is a Marker Interface? - An interface with no methods. Example: Serializable,


Remote , Cloneable
2. What interface do you implement to do the sorting? - Comparable
3. What is the eligibility for a object to get cloned? - It must implement the Cloneable
interface
4. What is the purpose of abstract class? - It is not an instantiable class. It proides the
concrete implementation for some!all the methods. So that the" can reuse the concrete
functionalit" b" inheritin# the abstract class.
5. What is the difference between interface and abstract class? - Abstract class defined
with methods. Interface will declare onl" the methods. Abstract classes are er" much
useful when there is a some functionalit" across arious classes. Interfaces are well
suited for the classes which aries in functionalit" but with the same method si#natures.
6. What do you mean by RMI and how it is useful? - R$I is a remote method inocation.
%sin# R$I, "ou can wor& with remote ob'ect. (he function calls are as thou#h "ou are
ino&in# a local ariable. So it #ies "ou a impression that "ou are wor&in# reall" with a
ob'ect that resides within "our own )*$ thou#h it is somewhere.
7. What is the protocol used by RMI? - R$I-II+,
8. What is a hashCode? - hash code alue for this ob'ect which is uni-ue for eer" ob'ect.
9. What is a thread? - (hread is a bloc& of code which can execute concurrentl" with other
threads in the )*$.
10. What is the algorithm used in Thread scheduling? - .ixed priorit" schedulin#.
11. What is hash-collision in ashtable and how it is handled in !a"a? - (wo different
&e"s with the same hash alue. (wo different entries will be &ept in a sin#le hash buc&et
to aoid the collision.
12. What are the different dri"er types a"ailable in !#$C? - /. A )01C-+01C brid#e 2. A
natie-A,I partl" )aa technolo#"-enabled drier 3. A net-protocol full" )aa technolo#"-
enabled drier 4. A natie-protocol full" )aa technolo#"-enabled drier .or more
information: 0rier 0escription
13. Is !#$C-%#$C bridge multi-threaded? - 5o
14. #oes the !#$C-%#$C $ridge support multiple concurrent open statements per
connection? - 5o
15. What is the use of seriali&able? - (o persist the state of an ob'ect into an" perminant
stora#e deice.
16. What is the use of transient? - It is an indicator to the )*$ that those ariables should
not be persisted. It is the users responsibilit" to initialize the alue when read bac& from
the stora#e.
17. What are the different le"el lockings using the synchroni&ation keyword? - Class
leel loc& +b'ect leel loc& $ethod leel loc& 1loc& leel loc&
18. What is the use of preparedstatement? - ,reparedstatements are precompiled
statements. It is mainl" used to speed up the process of insertin#!updatin#!deletin#
especiall" when there is a bul& processin#.
19. What is callable statement? Tell me the way to get the callable statement? -
Callablestatements are used to ino&e the stored procedures. 6ou can obtain the
callablestatement from Connection usin# the followin# methods prepareCall7Strin# s-l8
prepareCall7Strin# s-l, int resultSet("pe, int resultSetConcurrenc"8
20. In a statement' I am e(ecuting a batch) What is the result of the e(ecution? - It
returns the int arra". (he arra" contains the affected row count in the correspondin# index
of the S9:.
21. Can a abstract method ha"e the static *ualifier? - 5o
22. What are the different types of *ualifier and what is the default *ualifier? - public,
protected, priate, pac&a#e 7default8
23. What is the super class of ashtable? - 0ictionar"
24. What is a lightweight component? - :i#htwei#ht components are the one which doesn;t
#o with the natie call to obtain the #raphical units. (he" share their parent component
#raphical units to render them. Example, Swin# components
25. What is a hea"yweight component? - .or eer" paint call, there will be a natie call to
#et the #raphical units. Example, A<(.
26. What is an applet? - Applet is a pro#ram which can #et downloaded into a client
enironment and start executin# there.
27. What do you mean by a Classloader? - Classloader is the one which loads the classes
into the )*$.
28. What are the implicit packages that need not get imported into a class file? -
'[Link]#
29. What is the difference between lightweight and hea"yweight component? -
:i#htwei#ht components reuses its parents #raphical units. =ea"wei#ht components
#oes with the natie #raphical unit for eer" component. :i#htwei#ht components are
faster than the hea"wei#ht components.
30. What are the ways in which you can instantiate a thread? - %sin# (hread class 1"
implementin# the Runnable interface and #iin# that handle to the (hread class.
31. What are the states of a thread? - /. 5ew 2. Runnable 3. 5ot Runnable 4. 0ead
32. What is a socket? - A soc&et is an endpoint for communication between two machines.
33. ow will you establish the connection between the ser"let and an applet? - %sin#
the %R:, I will create the connection %R:. (hen b" openConnection method of the %R:, I
will establish the connection, throu#h which I can be able to exchan#e data.
34. What are the threads will start' when you start the ja"a program? - .inalizer, $ain,
Reference =andler, Si#nal 0ispatcher

You might also like