JAVA FAQ's
JAVA FAQ's
JAVA FAQ's
1.What is a transient variable? A transient variable is a variable that may not be serialized. 2. Which containers use a border Layout as their default layout?
The window, Frame and Dialog classes use a border layout as their default layout. .
Threads block on i/o that is enters the waiting state! so that other threads may e"ecute while the
7. What!s new with the stop "#$ suspend "# and resume "# methods in %&' ()*? 8. Is null a keyword?
The null value is not a keyword
The sto$ !, sus$end ! and resume ! methods have been de$recated in -D. /.2.
0. What is the preferred size of a component? The $referred size of a com$onent is the minimum com$onent size that will allow the com$onent to dis$lay normally /1. What method is used to specify a container!s layout? The set 2ayout ! method is used to s$ecify a container(s layout. .
The 3anel and A$$let classes use the Flow 2ayout as their default layout /2. What state does a thread enter when it terminates its processin,? &hen a thread terminates its $rocessing, it enters the dead state. .
The ,ollections A34 is a set of classes and interfaces that su$$ort o$erations on collections of ob%ects
/5. Which characters may be used as the second character of an identifier$ but not as the first character of an identifier? The digits 1 through 0 may not be used as the first character of an identifier but they may be used after the first character of an identifier /'. What is the List interface? The 2ist interface $rovides su$$ort for ordered collections of ob%ects /). How does %ava handle inte,er overflows and underflows? 4t uses those low order bytes of the result that can fit into the size of the ty$e allowed by the o$eration /6. What is the /ector class? The 7ector class $rovides the ca$ability to im$lement a growable array of ob%ects /8. What modifiers may be used with an inner class that is a member of an outer class? A non9local! inner class may be declared as $ublic, $rotected, $rivate, static, final, or abstract. .
The :: o$erator carries the sign bit when shifting right. The ::: zero9fills bits that have been
21. Which method of the Component class is used to set the position and size of a component? ;et <ounds !. 22. How many bits are used to represent 1nicode$ -2CII$ 13+4(5$ and 13+46 characters?
=nicode re+uires /) bits and A;,44 re+uire 6 bits. Although the A;,44 character set uses only 6 bits, it is usually re$resented as 8 bits. =TF98 re$resents characters using 8, /), and /8 bit $atterns. =TF9/) uses /)9bit and larger bit $atterns..
27. &oes ,arba,e collection ,uarantee that a pro,ram will not run out of memory?
$rograms to create ob%ects that are not sub%ect to garbage collection .
?arbage collection does not guarantee that a $rogram will not run out of memory. 4t is $ossible for $rograms to use u$ memory resources faster than they are garbage collected. 4t is also $ossible for
28. What restrictions are placed on the location of a packa,e statement within a source code file?
A $ackage statement must a$$ear as the first line in a source code file e"cluding blank lines and comments!.
30. What is the immediate super class of the -pplet class? 3anel. 31. What is the difference between preemptive schedulin, and time slicin,?
=nder $reem$tive scheduling, the highest $riority task e"ecutes until it enters the waiting or dead states or a higher $riority task comes into e"istence. =nder time slicing, a task e"ecutes for a $redefined slice of time and then reenters the $ool of ready tasks. The scheduler then determines which task should e"ecute ne"t, based on $riority and other factors. .
33. What value does readLine "# return when it has reached the end of a file?
The read2ine ! method returns null when it has reached the end of a file. .
34. What is the immediate super class of the &ialo, class? &indow. 35. What is clippin,?
,li$$ing is the $rocess of confining $aint o$erations to a limited area or sha$e. .
*es, a for statement can loo$ indefinitely. For e"am$le, consider the followingA for BB!.
38. What is order of precedence and associatively$ and how are they used?
#rder of $recedence determines the order in which o$erators are evaluated in e"$ressions. Associatity determines whether an e"$ression is evaluated left9to9right or right9to9left .
4f a checked e"ce$tion may be thrown within the body of a method, the method must either catch the e"ce$tion or declare it in its throws clause..
The ,heckbo"Cenu4tem class e"tends the Cenu4tem class to su$$ort a menu item that may be
46. When a thread is created and started$ what is its initial state?
A thread is in the ready state after it has been created and started. .
47. Can an anonymous class be declared as implementin, an interface and e:tendin, a class?
An anonymous class may im$lement an interface or e"tend a su$erclass, but may not be declared to do both..
50. In which packa,e are most of the -W3 events that support the event4dele,ation model defined?
$ackage. The A&T>vent class is defined in the %ava.awt $ackage. .
Cost of the A&T9related events of the event9delegation model are defined in the %ava.awt.event