The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2000

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:

GUI In applet

Posted by Kishori Sharan on July 05, 2000 at 11:45 AM

There is no problem initializing b1 and b2 in one declaration. The problem is the name of the applet. Change the name from Button to anything else like Button1 and your code will compile fine. It's because Button is a Java defined class.

Thanx
Kishori

> import java.awt.*;
> import java.applet.*;

> public class Button extends Applet{
> Button
> b1=new Button("Button 1"),
> b2=new Button("Button 2");
> public void init(){
> add(b1);
> add(b2);
> }
> }

> the above is a little program direct from the book Thinking in Java.But I can not interpret it.two error message prompt up saying" wrong number of arguments in constructor"
> I also saw other books, this program is proved to be correct . But Why can't it be complied with JDK1.2.2?
>






Replies:

Sponsored Links



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