• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exam Question

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Jane
[This message has been edited by Jane Griscti (edited October 03, 2000).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic