• Register
0 votes
I am new to java programming . I wrote a code in java programming language to start my projcet of learning java:  

public class Main {
  public static void main(String[] argv){
     int 2count, h-l, a/b, 


But it gives me errors like :

exception in thread "main" java.lang.Error: Unresolved compilation problems
Syntax error on token "2", delete this token
Syntax error on token "h", = expected after this token
Syntax error on token ",", . expected
Syntax error on token ",", ;expected
at Main.main(Main.java:3)

Why am I getting this errors can anyone help me out to solve this?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

0 votes
every letter in a java keyword are uses as java identifiers.
an indentifer must be begin with a lower case letter , a dollar sign($),or an underscore(_);subsequent characters may be upper case letters, dollar signs, underscores
or digits.
Some Example are :
fobar      //legal
Myclass    //legal
$a         //legal
3_a        //illegal : starts with a digit
!thevalue  //illegal : bad 1st char


11 6 4
34,950 points

Related questions

0 votes
1 answer 5 views
Problem: In a python program I am making, I want it to only take integers, and if it gets a string say "There has been an error in the system." instead of murmering sensless information the user will not understand
asked Jan 11 Mashhoodch 5.6k points
2 votes
2 answers 274 views
Problem: I have a simple python program I wrote recently. But unfortunately, I can’t compile and run my program. It shows me an error “syntaxerror: keyword can't be an expression” Where I am being wrong in my program? Any idea? The snippet is attached below: name = input("Please ... a Gentleman!") else: print(name + " I don't know him and " + name = " Who is he? ") Thanks, guys.
asked Mar 11, 2020 Gavin 15.3k points
1 vote
1 answer 23 views
Problem: Hello Kodlogs, I am a Java developer and recently wished to learn one more computer programming language to more substantial my skill set. So, given priority to my thoughts, I jumped into learning Python programming. I am solving problems every day with Python. Anyway, I was ... such an option to do that? If you can share the trick with me it would be much helpful for me. Thanks, mate.
asked Jul 6, 2020 adamSw 11.3k points
0 votes
1 answer 15 views
I need a program that will print next to last word of a sentence
asked Sep 22, 2020 Daniel Anderson 4k points
0 votes
1 answer 10 views
Problem Hey, I want to know which tools are non mandatory for integration in CI pipeline. Can you help me figure them all?
asked Jan 11 chris jordan 2.2k points
0 votes
1 answer 4 views
1 vote
1 answer 202 views
Problem: I am looking for a solution to my existing code. Well, I am a new student of java. I was thinking about a program that can check whether the given char is an upper case or not! Let’s say I’ve given a char as ‘a’ and I want ... , my question is, how to check whether a char variable ch is an uppercase letter, you write? Thanks for your valuable time and effort guys.
asked Mar 22, 2020 Gavin 15.3k points
0 votes
1 answer 65 views
I am new to python programming. I was trying to compare two strings, I wrote a code to compare: YourStr = "one" MyStr = "one" if YourStr = MyStr print("Two strings are same") else print("Two strings are not same") But it gives an error: File "main.py", line 4 if YourStr = MyStr ^ SyntaxError: invalid syntax Whats wrong in my code and how can I compare two string but it is not case sensitive?
asked Mar 16, 2020 LizzyM 6.1k points