• Register
0 votes
62 views
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,050 points

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,930 points

Related questions

2 votes
2 answers 168 views
168 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 Gavin 15.3k points
0 votes
1 answer 9 views
9 views
I need a program that will print next to last word of a sentence
asked Sep 22 Daniel Anderson 4k points
1 vote
1 answer 23 views
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 adamSw 11.3k points