aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exam Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exam Question" Watch "Exam Question" New topic
Author

Exam Question

Hans
Greenhorn

Joined: Sep 20, 2000
Posts: 11
1)A copy of the original event is passed into a listener method. true/false.
Why?
2)an object obj1 can access an object obj2 that is eligible for garbage
collection, then obj1 is also eligible for garbage collection.
Object ob1=new Object();
Object ob2=new Object();
ob1=null;
ob2=ob1;
Whether ob2 can be gc?
3)Given a TextArea using a proportional pitch font and constructed like this:
TextField t = new TextArea("12345", 5, 5);

Which statement is true?
A. The displayed width shows exactly five characters on each line unless
otherwise constrained.
B. The displayed height is five lines unless otherwise constrained.
C. The maximum number of characters in a line will be five.
D. The user will be able to edit the character string.
E. The displayed string can use multiple fonts.
Answer is B,D.I code prog.I find only D is ok.Because TextArea t's width and
height can be changed when you edit text in t.If I am wrong.Please correct.
Thank you.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Hans,
1. False. Java passes a copy of the reference to the original event; not the object itself. Java uses pass by value for everything. When a primtive type is passed, a copy of the actual value is passed. When an object is passed, a copy of the reference to the object is passed.
2. Obj2 should be eligible for gc as it has been set to null. Once a variable has been set to null it becomes unreachable and eligible for gc.
3. B is ok because the question only asked what is displayed; not what happens after someone edits the text.
If I've got any of them wrong hope someone will jump in and correct me.
Jane
[This message has been edited by Jane Griscti (edited October 03, 2000).]


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exam Question