Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI with constructor

 
xiao sean
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i'm trying to build a program to match a string of id to another string 1234567 with a GUI and constructor.
but i'm struck and confuse on how to i continue with the constructor method
please advice how do i carry on...

[ September 22, 2007: Message edited by: xiao sean ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you stuck on? Compiling? A runtime error? How to implement something specific?
 
xiao sean
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
What are you stuck on? Compiling? A runtime error? How to implement something specific?




hi, thanks for reply.
i sort of struck on the else statement after i change the code. (!c==d) eror in compile " else without if

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the code with some indentation, we have:


For the snippet you are asking about, we have:


The compiler reads this as:
- if c does not equal d, set status to false
- in a separate (redundant) block, set text to correct id
- else - wait, what else? There was no if. Well, there was one, but it was a whole step ago.

Basically the problem is that your { is only line later than you intend it to be.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic