aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Memorize Continer inheritance? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Memorize Continer inheritance?" Watch "Memorize Continer inheritance?" New topic
Author

Memorize Continer inheritance?

paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 19679
    ∞

This is a question from the Hunt mock test:
<pre>
Q. 16
Which of the following are acceptable?
A.Object o = new Button("A");
B.Boolean flag = true;
C.Panel p = new Frame();
D.Frame f = new Panel();
E.Panel p = new Applet();
Select all correct answers.
</pre>

On the mock test from the RHE book, the question would start with a tree showing the inheritance of all the objects you would be in the question.
On the hunt test, it seems you have to have memorized these relationships.
Which way does the SCJP2 test do it?

permaculture forums
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
It's one of the peculiar aspects of the SCJP exam that you are asked to memorize things that seem pointless. If you understand the basic inheritance structure, and have either the online docs or something like "Java in a Nutshell" to hand, why would you need to memorize an inheritance hierarchy? Similarly, just trying to compile a Java class will catch all those "which is a keyword" and "which is valid syntax" questions.
However, in order to have any questions to ask in the exam, they seem to require that we alll memorize such tedious stuff. Certainly to get my SCJP 1.1 I had to remember stuff like the above. I quickly forgot it again though


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 19679
    ∞

I can understand memorizing the keywords, but the hierarchy for all of the AWT?
I think I'll memorize just Applet, Panel and Frame. That should cover me.
Gary Lupul
Greenhorn

Joined: Aug 23, 2001
Posts: 5
Although I haven't written the exam, yet. It seems that some of hierarchies are probably worth remembering:
-Collection interface down
-IO
-events
-various important components
Could someone who took the exam attest to the validity of memorizing those hierarchies?
As a Java programmer, though, I feel that knowing the following is basic and valuable for a Java programmer to know.
-->Component
-->Container
-->Panel-->Applet
-->Window-->Frame

I am wondering if it's worth memorizing what Listeners have adapter classes?
thanks,
Gary
Gaja Venkat
Ranch Hand

Joined: Aug 10, 2001
Posts: 50
Hi:
The Sun exam does test on AWT hierarchy. Initially it may look like a pure memorizing task. But after coding small programs and trying to depict the hierarchy as a tree, it will become quite easy to remember these. Then all that is required is to just go through the notes and the tree structure again before Exam day.
Compared to java.io package, I don't think there is a lot to memorize here. (Please refer to my post in certification result forum to check out some tips on making java.io study easier. Probably something similar could be applied to java.awt also!)
The exam does test on listeners & adapters. Here again, I don't think this is a pure memorizing task. To study such things in an easy manner, probably some logical method could be devised.
For example, listener is an interface. If the listener interface has more than one method, then a class implementing this interface should implement all the methods, even if the class is actually interested in implementing only one method! So an equiavlent adapter class is provided with all these methods but with empty bodies.
Suppose a class needs to implement just a method, say windowClosing() method of WindowListener interface, then if it implements this interface, it has to provide empty bodies for all the remaining six methods of Windowlistener interface. Now a readymade WindowAdapter class is available with empty methods for all the seven methods of WindowListener interface. So our class can just extend this adapter and override the windowClosing method alone.
Now that this is the main purpose of adapter, to study about which listeners have corresponding adapters, all we need to do is to take note of the listener interfaces having more than one method. Because, if the listener has only one method, then an equivalent adapter will not be there as it is not necessary.
This analysis will make clear that ActionListener, AdjustmentListener, ItemListener etc don't have corresponsing adapters as each of them has only one method.
This information is best given in leading books & tutorials. I thought of explaining this just to show how tasks can be changed from "memorizing" to "logical reasoning & studying" as far as possible.

Hope this helps,
Gaja Venkat
Sun Certfied Programmer for Java 2 Platform
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Great explanation Gaja.
To add some more points to what you said,
points from Khalid & Rolf's book.
AWTEvent classes
- semantic events
ActionEvent, AdjustmentEvent,ItemEvent and TextEvent
- Low level Events
ComponentEvent,ContainerEvent, FocusEvent,KeyEvent,
MouseEvent,PaintEvent and WindowEvent
Lowlevel Event listeners have adapters. Semantic events doesn't have adapters.
Hope this helps,
Vanitha.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Memorize Continer inheritance?
 
Similar Threads
mock exam rating
does notify() stop a thread?
Khalids mock exam
Pragmatic Unit Testing in Java with JUnit by Andy Hunt, Dave Thomas
who have appeared in SCJP