My school task is to make a program with the price of sending a letter: input grams, output price. but i get this error.
Asked
Active
Viewed 168 times
-5
-
4Might have forgotten some things. Like the error message. And your code. – AntonH Mar 07 '17 at 19:25
-
1Post your code and stacktrace. – Atul Mar 07 '17 at 19:26
-
A picture of your code is not your code. Please take the time to [edit] your question to add the code as text. – azurefrog Mar 07 '17 at 19:26
-
Post your code and error, not a picture of them. – AntonH Mar 07 '17 at 19:26
-
Please don't post screenshots. Copy, paste, and format your actual code directly here. Looks like you don't have a class to contain your method. Pick up a basic java tutorial. Did you read the error message? Did you google it? – tnw Mar 07 '17 at 19:27
-
Read what the compiler says, looks obvious to me closing parenthesis are missing. – Jerome L Mar 07 '17 at 19:27
-
You need a class. – shmosel Mar 07 '17 at 19:27
-
There are multiple issues with your program. 1. Main method has to be `public static void main(String[] args) 2. Class name is incorrect. Java is a case sensitive language. `scanner` and `Scanner` both are not same. Use `Scanner` instead of `scanner`. 3. Instead of `system.in` use `System.in`. Before writing any code you should at least go thru the [documentation/tutorials][1] available online to understand language. [1]: https://docs.oracle.com/javase/tutorial/java/ – Atul Mar 07 '17 at 19:36
2 Answers
0
your main signature is wrong, it's public static void main(String args[]) {...}, also you missed the class definition, system.in is a static call, so should be Capitalized, man, your code has lots of typos

Paulo Ricardo Almeida
- 509
- 3
- 12
0
public static void main()
is not the correct method to make an execution class.
Second, Scanner
class should be capitalized.

hfontanez
- 5,774
- 2
- 25
- 37
-
I got it, and fixed the rest. now I have no syntax error. Thanks many times – asdkp1 Mar 07 '17 at 20:00