*
The moose likes Beginning Java and the fly likes I WANT2 CHANGE METHOD, BUT IT DOESNT WORK, HELP~ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I WANT2 CHANGE METHOD, BUT IT DOESNT WORK, HELP~" Watch "I WANT2 CHANGE METHOD, BUT IT DOESNT WORK, HELP~" New topic
Author

I WANT2 CHANGE METHOD, BUT IT DOESNT WORK, HELP~

Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
hello everyone~~~im trying2 creat a program for inventory of bookshop

and i ve made several classes and they r interactive

just wonder: ...



this iz some method in my main bookshop class, and now i want2 change them2 "things like":


i tried it, but it doesnt work~~~iz there anyway2 do it???~~~if i done this, iz there affect2 other classes/the whole thing? OR no more interactive???

THX A LOT~~~~~~~~~~
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

When you say it "doesn't work," what exactly do you mean? Are there error messages at compilation? At runtime?

(If you're using Java 5.0, then you should look at the new enums feature.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

1. Please avoid using capital letters (this is used for shouting)
2. Please avoid use bold characters to focus on something. Do not bold the whole message
3. Please do not use abbrevations like 'r' for 'are', '2' for 'to', or words like 'iz' for 'is'. It just makes it difficult to read for non native speakers.

Thank you


[My Blog]
All roads lead to JavaRanch
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
Originally posted by Satou kurinosuke:
1. Please avoid using capital letters (this is used for shouting)
2. Please avoid use bold characters to focus on something. Do not bold the whole message
3. Please do not use abbrevations like 'r' for 'are', '2' for 'to', or words like 'iz' for 'is'. It just makes it difficult to read for non native speakers.

Thank you


really sorry~~~
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
Originally posted by marc weber:
When you say it "doesn't work," what exactly do you mean? Are there error messages at compilation? At runtime?

(If you're using Java 5.0, then you should look at the new enums feature.)


yes, there are error messages coming out
like for "private static final int DISPLAY B = 1;"

"; expected"
... ...
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Your variable must be one word.
Try to change "DISPLAY B" by something like "DISPLAY_B"
Same for "DISPLAY R".
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Jose Cisse:
...yes, there are error messages coming out
like for "private static final int DISPLAY B = 1;"

"; expected"
...

Oh, I see. You can't have a space in an identifier (variable name). You could use underscores, like DISPLAY_B and DISPLAY_R.
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
OH~~~got it~~~THX a lot~~~


and...how do i deal with word "menu" ?
it always shows the error message:"cannot resovle symbol"

like: for" int option = getMenuInput();"

the error message coming out" cannot resovle symbol-method getMenuInput()"
???

MANY THX~~~
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

It cannot find the method getMenuInput(). Are you sure there is such a method in your class ? If there is, check typos in its name.
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
yes, i think so
i worte like


but method "displaymenu" cannot resolve sybmol as well...why???
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You are calling methods, but do they actually exist ?
You should have those methods somewhere:
[/code]
void displaymenu() {
...
}
int getMenuInput() {
...
}
void doOption(int) {
...
}
[/code]
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
Originally posted by Satou kurinosuke:
You are calling methods, but do they actually exist ?
You should have those methods somewhere:
[/code]
void displaymenu() {
...
}
int getMenuInput() {
...
}
void doOption(int) {
...
}
[/code]


sorry, can you say abit more specific?
if they dont exist, how do i fix them? OR example please~~~

MANY THX~~~
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16



1. You are calling displaymenu(). Where is this method ?
2. You are calling getMenuInput(). Where is this method ?
3. You are calling doOption(). Where is this method ?
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
ok, i understand it...
but how do you create those method (in order to make the whole thing work)???

MANY THX~~~
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Is this some homework ? I don't want to throw out the solution if you were asked to do this.
But think about it. There were already the necessary methods in the first version of your program. The second version contains the same logic, with different method names.
Jose Cisse
Greenhorn

Joined: Mar 20, 2006
Posts: 28
Originally posted by Satou kurinosuke:
Is this some homework ? I don't want to throw out the solution if you were asked to do this.
But think about it. There were already the necessary methods in the first version of your program. The second version contains the same logic, with different method names.


ok~~~thx a lot~~~
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: I WANT2 CHANGE METHOD, BUT IT DOESNT WORK, HELP~