my error is in float sum = x + y + z+;
the error says can't find symbol x
I have been trying to figure it out and got rid of my other errors. this is the information I had to go on:
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Originally posted by Vanessa Roach:
I did a copy and paste with your code about three times and went through it line for line. Does the fact that I am using jGRASP for the code make a difference. I am sorry to be such a bother and I am really trying to understand.
Originally posted by Vanessa Roach:
[error] ----jGRASP exec: java BuyingLunch
java.lang.NoSuchMethodError: main
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
[/error]
I appreciate your help on this. I'm not sure why the static in my code. To be honest I have never done java before this semester and am finding it impossible. I am supposed to graduate in may with associate in web design.
Ah, I see, web design is very different from Java. :-)
You got the NoSuchMethodError: main is because you didn't write a main method for your class. Main method is just like any method in your class but it has this signature : public static void main(String[] args) { //code } . You need this main method as an entry point to run your code.
Put something like this inside your class and it should run:
Something I don't understand and have never seen is the bl in the main. Why is it there and what does it mean?
Originally posted by Vanessa Roach:
I'm sorry.... I still don't understand the local variable in the solution. I understand variables and understand the try catch but like with last week in class other people were using a line like the
and this may sound stupid but I don't understand it.
Originally posted by Vanessa Roach:
and this may sound stupid but I don't understand it.
Originally posted by Henry Wong:
And here is the ironic part... Originally, you didn't need it. If LS chin hadn't converted your methods from static methods to instance methods, you could have called the methods directly from main, without the need for the bl variable.
Please don't try to get the thing working with static methods; using only instance methods is much better object-oriented design.Originally posted by LS chin:
Can you show us how to write it with the static methods?
I'm still learning static methods and static variables.
Originally posted by Campbell Ritchie:
Please don't try to get the thing working with static methods; using only instance methods is much better object-oriented design.
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|