The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

applets

Posted by teji on May 28, 2001 at 11:12 AM

hi
i want to know what is happening in the following program
class app extends Applet
{
Button b=new Button("hello");
public void init()
{
add(b);
add(b);
add(b);
add(b=new Button("hi"));
add(b=new Button("there"));
}
}
when i view the output i see three buttons one with label hello second with hi and third with there .why did the two other buttons with label hello show up..also if i want to show them up in the way i have written what smallest alteration can be made to this program to do so.
thanks
teji



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us