Computer Science Canada public static.... |
| Author: | magicman [ Wed May 31, 2006 11:22 am ] | ||
| Post subject: | public static.... | ||
i have a program that i have to make for my end project and i need alittle help with it. so far this is what i have.
its giving me a dumb @$$ error, The Method "int stage1();" must contain a return statement with an expression compatible with type "int". how do i fix it??? and if you see any thing else that i should do, please speak up. |
|||
| Author: | md [ Wed May 31, 2006 11:38 am ] |
| Post subject: | |
you need to return an int with the return statement |
|
| Author: | magicman [ Wed May 31, 2006 11:41 am ] |
| Post subject: | |
Common man, thats not even funny... i would like some REAL HELP!!!!! |
|
| Author: | wtd [ Wed May 31, 2006 12:02 pm ] |
| Post subject: | |
I'm guessing that you have absolutely no idea why there's an "int" in "public static int"". This is a phenomenally important concept to understand. Read my Introduction to Java. It's available in the Java Tutorials forum. |
|
| Author: | md [ Wed May 31, 2006 12:38 pm ] |
| Post subject: | |
I was serious. It's a very clear error message. |
|
| Author: | codemage [ Wed May 31, 2006 12:54 pm ] |
| Post subject: | |
Enough of the slack jawed non-helpful comments. Read below for some super-secret REAL help: Quote: You need to return an int with the return statement. |
|
| Author: | wtd [ Wed May 31, 2006 1:26 pm ] |
| Post subject: | |
codemage wrote: Enough of the slack jawed non-helpful comments. Read below for some super-secret REAL help:
Quote: You need to return an int with the return statement. Mine was not a non-helpful comment. This is a fine suggestion, except that it does not address the (suspected) underlying issue, which is connecting the "int" in "public static int" with the method returning an int. If a programmer can "get" that, then it's a simple matter to realize that "public static String" for instance means the method has to return a String. Then of course you have to understand what public and static mean. |
|