Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

actionListener (will not compile)

 
Cuong Tran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, this is my first post as I'm new here...
I can't seem to get this to compile, can someone tell why it's not compiling... I'm nearly 100% sure it's not a syntax error... please help
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ April 02, 2004: Message edited by: Dirk Schreckmann ]
 
Sgubudu Nhlumayo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
Java Classes have constructors.
These are used to initialize the object.
You have used a method ,"public void question_1()",
please change this to public Chapter7(){//initialize }don't
change the code inside the method question_1.

"We are computer professionals ,we cause accidents"
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will help you can give us a bit more information.
First of ally, you can preserve the indentation in your code by using [ code ] tags. There is a button below the reply message box that will add them automatically to your message. Just copy and paste the code in between the tags.
More importantly, we need the error messages you get when you compile. Please copy and paste them here. Also, make a note about which line each error refers to. Comments in the code can help with this.
I'll be more than happy to help you solve the compiler errors after you post them here.
Keep coding!
Layne
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a scope problem.
Move this line
JButton btnHello1 = new JButton ("Button 1"),btnHello2 = new JButton ("Button 2");
to immediately above this line
public void question_1(){
and it should compile OK.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic