• 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

My test is in 10 days! I need a little help!

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Questions that I am having problems with.
This is from the Mock on The Roberts /Heller Cdrom
27.
A componet subclass that executed enableEvents()
to enable processing of a certain kind of event cannot
use an adapter as a listener for the same event.
true or false
29.
You want to modify your code so that cyan lines accumulate
on the screen rather then getting erased every time
repaint() calls update().
g.setColor(Color.cyan); Is this answer correct?

from Mughal
Which is the earliest line in the following code after
which the object created on line marked 0 will be a
canidate for being garbage collected?
( Would line 4 be the correct answer?
42.
public class Q76a9 {
static String f() {
String a= "hello";

String b= "bye" ; 0
String c= b+ "!" ; 1
String d=b;
b=a; 2
d=a; 3
returm c; 4
}
public static void main(String args[])
{
String msg =f();
System.out.println(msg); 5

}
}

next question:
Write a Line of code that declares a variable named layout
of type layoutmanager and initializes it with a new object,
and lays out components in a grid 3 components high and
2 components wide.
another question:
Which statements , when inserted at the indicated position
will cause a runtime exception when attempting to run the program?

Class A{}
Class B extends A {}
Class C extends A {}
public class q3ae4 {
public static void main(String arg[]) {
A x = new A();
B x = new B();
C z = new C();
insert
}
}

When you answer these questions please explain a little why.
thanks
Here is a reward for you.
www.motley.com free legal mp3 hard rock
www.quake3arena.com A great game demo of q3 with bots! (AI)
www.unrealtournament.com another very cool game with bots.
exercise :
www.hammerstrength.com
www.medxonline.com
www.gnc.com
www.superslow.com
http://www.mikementzer.com/
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CyberOptic,
Please post 1 question per new thread so that it is easy for people to answer and to try to keep this site more professionally moderated. Thank you for your understanding and co-operation.
regds
maha anna
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you are not going to answer my questions.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are my replies.The numbers below correspond to ur questions.
1)False.But the listeners will receieve no notification of those events.
2)The code u have written is fine,but u need to overrdide update(Graphics g)because update clears the component to it's background color and then calls paint.What u need to do is
public void update(Graphics g)
{paint(g);}
3)I think obj. referenced by b will be eligible for gc after the statement b=a. b and a both will hold a ref. to same String obj.
4)GridLayout g = new GridLayout(3,2);
Your fifth ques. is not clear.Please clarify.
Try writing your own code to sort out such problems.
------------------
Come on in !! Drinks are on the house in the Big Moose Saloon !!
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Udayan,
The answer to question 3 would be ,' obj referenced by b will be eligible for gc after the statement d = a, because before the statement d = a is executed, d is a reference to the object originally referenced by b (remember the statement d = b ??)
 
reply
    Bookmark Topic Watch Topic
  • New Topic