This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exam Question

Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)A copy of the original event is passed into a listener method. true/false.
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();
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
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
[This message has been edited by Jane Griscti (edited October 03, 2000).]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic