• Register
0 votes
213 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,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 2 views
2 views
Problem: Throws keyword is used only for checked exception. It instructs the caller to use try catch block to except all the listed exceptions by throws keyword. Since we know what kind of checked exception might occur in our module, then: Why don't we use try ... except the same inside the module itself? In that way we need not to manually except the exceptions every time the method is called.
asked 2 days ago muktaa 34.4k points
0 votes
1 answer 9 views
9 views
Problem : Any ideas on what I need to do to fix this? Thanks!-the keywords in java are all in lowercase.?
asked Mar 15 Samiur1 38.4k points
0 votes
1 answer 3 views
3 views
Problem: Normally, I use this in constructors only. I understand that it is used to identify the parameter variable (by using this.something), if it have a same name with a global variable. However, I don't know that what the real meaning of this is in Java and what will happen if I use this without dot (.).
asked Apr 11 Sana8989 8.9k points
0 votes
1 answer 5 views
5 views
Problem: I need assistance in resolving this problem in What is the java keyword final used for in a program?
asked Apr 1 rakib1 51.5k points
1 vote
1 answer 31 views
31 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 13 views
13 views
Problem: a constant can be defined using using the final keyword. compiler showing this error. Any help will be appreciated. Thanks
asked Feb 25 jyoti goyal 2.1k points
1 vote
1 answer 5 views
5 views
Problem: Someone asked me about this but I have no any clue. Ref keyword must be used while using out parameter mechanism.
asked Mar 24 PkGuy 23.5k points
0 votes
1 answer 1 view
1 view
Problem: Please let me know any solution regarding this .. C++ capitalize first letter of each word
asked 4 days ago Ifra 34.7k points
0 votes
1 answer 4 views
4 views
Problem: I have a batch of strings, I want to capitalize the first character of each word and have the remaining characters lowercase - except any references of iPhone or iPad
asked Mar 31 ummesalma 29.2k points