Answer: hierarchy and static init blocks : Questions « Utility Classes « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Utility Classes » Questions 
8.30.22.Answer: hierarchy and static init blocks
r1 r4 pre b1 b2 r3 r2 MainClass
Static init blocks are executed at class loading time
Instance init blocks run right after the call to super() in a constructor. 
When multiple init blocks of a single type occur in a class, they run in order
8.30.Questions
8.30.1.What happens when you try to compile and run code containing the following lines:
8.30.2.Answer: Float + String
8.30.3.Which of the following Collections classes can return object references in the order of addition?
8.30.4.Answer: collection and order
8.30.5.Which of the following interfaces in the java.util package does java.util.Hashtable implement?
8.30.6.Answer: Hashtable and interface
8.30.7.What does Math.random() method return?
8.30.8.Answer: return value from Math.random()
8.30.9.What kind of stream is the System.out object?
8.30.10.Answer: System.out stream
8.30.11.When // XXX is reached, how many objects are eligible for GC?
8.30.12.Answer: garbage collection
8.30.13.What is the result(overloaded and var-args methods)?
8.30.14.Answer: overloaded and var-args methods
8.30.15.What is the result(array dimension)?
8.30.16.Answer: array dimension
8.30.17.What is the result(constructor)?
8.30.18.Answer: constructor
8.30.19.What is the result(final class reference)?
8.30.20.Answer: final class reference
8.30.21.What is the result(hierarchy and static init blocks)?
8.30.22.Answer: hierarchy and static init blocks
8.30.23.What is the output(enum)?
8.30.24.Answer: enum
8.30.25.What is the result(static variable)?
8.30.26.Answer: static variable
8.30.27.What is the result(autobox and widen)?
8.30.28.Answer: autobox and widen
8.30.29.Which are true about the objects created within main(), and eligible for garbage collection when line 14 is reached?
8.30.30.Answer: garbage collection and array objects
8.30.31.When 'do stuff' is reached, how many objects will be eligible for garbage collection?
8.30.32.Answer: ready for garbage collection
8.30.33.What is the result(class instance variables)?
8.30.34.Answer: class instance variables
8.30.35.What is the result(pre-increment operators)?
8.30.36.Answer: pre-increment operators
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.