wood burning stoves 2.0*
The moose likes Associate Certification (OCAJP 7) and the fly likes Question for Edward Finegan and Robert Liguori or anyone who has given OCAJP7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7)
Bookmark "Question for Edward Finegan and Robert Liguori or anyone who has given OCAJP7" Watch "Question for Edward Finegan and Robert Liguori or anyone who has given OCAJP7" New topic
Author

Question for Edward Finegan and Robert Liguori or anyone who has given OCAJP7

Rohan Deshmkh
Ranch Hand

Joined: Aug 31, 2012
Posts: 127
I earlier posted this question in one of the threads of certification results, but didn't got an answer as i posted it quite late after the discussion was over.
So i thought i would better ask it here.
I wanted to know if we get questions on garbage collection ,inner classess and object casting in the real OCAJP7 exam?
Robert Liguori
Author
Ranch Hand

Joined: Nov 27, 2007
Posts: 493
    
    5

Rohan Deshmkh wrote:I earlier posted this question in one of the threads of certification results, but didn't got an answer as i posted it quite late after the discussion was over.
So i thought i would better ask it here.
I wanted to know if we get questions on garbage collection ,inner classess and object casting in the real OCAJP7 exam?


Garbage Collection: No
Inner Classes: No
Casting: Yes, "Objective: Determine when casting is necessary"

Objectives (Refresh the page on the first visit):
http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_org_id=&lang=&p_exam_id=1Z0_803

-- Robert


My Blog (I frequently post on Java, JSF and NetBeans)
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3204
    
    2
Rohan Deshmkh wrote:I earlier posted this question in one of the threads of certification results, but didn't got an answer as i posted it quite late after the discussion was over.
So i thought i would better ask it here.
I wanted to know if we get questions on garbage collection ,inner classess and object casting in the real OCAJP7 exam?


Although not mentioned explicitly in the exam objectives, some candidates have reported seeing questions on garbage collection in the OCAJP 7 exam. It is possible that they are unscored questions. That is why we have include a few very basic questions on this topic in our mock exam simulator.

HTH,
Paul.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Rohan Deshmkh
Ranch Hand

Joined: Aug 31, 2012
Posts: 127
In Casting are the questions based on simple primitive type casting like :


or does it include object casting also.I often get confused in object casting.
For eg. see the following code:


I don't understand what does line B o2=(B)o1 will do? And which method from which class will be called using o2?
Tina Smith
Ranch Hand

Joined: Jul 21, 2011
Posts: 171
    
    5

You have C IS-A B IS-A A, so it is legal to cast from a C instance to a B instance. You need the cast of course because you're casting down (since the compiler only knows it is an A) from A to B instead of up.

The line you describe
a) Declares a variable named o2 and specifies it holds something that is AT-LEAST a B. It might be something more specific (like a C) but will not be something less specific (like an A) or something random (like a String).
b) Converts the value in o1 to a B and stores the value in o2. A little explanation here: o1 IS-A C, but is stored in an A. The compiler knows that o1 is AT-LEAST an A, but could be something more specific like a B or a C (which it in fact is). You can't treat it like a C though because the compiler only knows you said it was an A.

o2 will call the method from the instance which it actually is. o2 IS-A C, because the object it was created from IS-A C. If you call m1() on both objects, you will find that they both refer to the C's implementation of the method. But the tricky part is if you ask for i on each object, you will find it refers to the object type it was declared as - o1 returns A's i and o2 returns B's i. This is because Java handles variable polymorphism differently than methods. Methods override and extend the functionality so you can call a method on a base class and it will execute the subclass's implementation. Variables will always return the instance they are located in. You cannot override a variable - redeclaring it in a subclass gives you two copies of the variable. When you reference the object as its subclass, you get the subclass variable, when you reference as the superclass, you get the superclass variable. This is called hiding.

Try compiling and running your example code then play with it a little - make sure that you call m1() from both instances, and read i from both instances to see what I mean.

The casting you need to be concerned with on the exam is object casting, and from what I remember of the beta the questions are similar to what you posted. You need to be able to determine if the code will compile, and if it compiles what the output will be. I found the OCJA to be pretty fair though. You need to know your stuff, but once you know it, they don't really go out of their way to trick you.


Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question for Edward Finegan and Robert Liguori or anyone who has given OCAJP7
 
Similar Threads
OCPJP6 or wait for OCAJP7+OCPJP7
OCAJP FAQs
Passed OCAJP7 with 88%
Question for those who have given OCAJP7
What is the minimum score to pass OCAJP7?