• Register
1 vote
99 views

Problem:

I am a begginer in java programming language and I have been coding for just some days. To practice my programming I wrote this code in java:

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

  }
}

But It shows me the error message:

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)

Whats is wrong in my code can anyone help me out?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

1 vote

Answer:

In java programming every letter in a java keyword are used as java identifiers. So 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

I hope this may help you and you understand the thing.

Happy coding.

11 6 4
34,950 points

Related questions

0 votes
1 answer 26 views
26 views
I am having a problem importing classes and setting variables and I need help with a test program I am doing.
asked Jan 23 TeamScript 13.5k points
0 votes
1 answer 20 views
20 views
Problem: I am having a problem importing classes and setting variables and I need help with a test program I am doing. So I am testing out a program that just simply outputs what your input was and puts a time stamp ( Like Skype ). I am having an issue getting the message and time variable type to work!
asked Feb 18 Ali 4.4k points
0 votes
2 answers 2.5K views
2.5K views
Problem : I am having a trouble while importing classes and setting variables and also I need help with my test program which I am doing. I want to test a program that simply outputs what the input was and puts the time stamp ( like Skype does ). I am having ... Message cannot be resolved to a type Message cannot be resolved to a type The constructor Time() is undefined at MyTest.main(Test.java:8)
asked Jan 28, 2020 jwilliam 3.9k points
0 votes
1 answer 131 views
131 views
Problem : I am having a problem importing classes and setting variables and I need help with it. I am getting below error exception in thread "main" java.lang.error: unresolved compilation problem:
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
0 answers 19 views
19 views
my program (java) is below. I wrote it with eclipse IDE. I still can&rsquo;t figure out the mistake. package com.in28minutes.firstjavaproject; public class MultiplicationTable { void print() { for (int i = 1; i <= 10; i++) { System. ... public class MultiplicationTableRunner { public static void main(String[] args) { MultiplicationTable instance = new MultiplicationTable(); instance.print(); } }
asked Feb 6 chathura2001 120 points
0 votes
1 answer 6 views
6 views
Problem: This is a feature of NoSuchMethodError in Java and complains about "main" which is the name of the method that JVM tries to connect to but doesn't find in the wrong class. java.lang.NoSuchMethodError
asked Feb 7 ahmedadel9090 2.6k points
0 votes
1 answer 15 views
15 views
Problem: I have a piece of code and I could not figure out why it is giving me Exception in thread "main" java.lang.StackOverflowError. I know the problem lies with the recursion. The error does not occur if the input is a small value, example: 5. But when the ... 65) at Test.printSyra(Test.java:60) at Test.printSyra(Test.java:60) at Test.printSyra(Test.java:60) at Test.printSyra(Test.java:60)
asked Feb 2 Ali 4.4k points
0 votes
1 answer 19 views
19 views
Problem: java.lang.NullPointerException is one of the most popular exceptions in java programming. Anybody working in java must have seen this popping out of nowhere in java standalone program as well as java web application. Some of the common reasons for ... an object instance but at runtime the object is null. Accessing variables of an object instance that is null at runtime.
asked Feb 1 Ali 4.4k points
0 votes
1 answer 36 views
36 views
explain with an example?
asked Nov 18, 2020 jagruthi 680 points
1 vote
1 answer 48 views
48 views
Problem: I got error while applying weblogic patch useing bsu.sh: patch_download_dir=$FMW_HOME/utils/bsu/cache_dir -patchlist=GFWX -prod_dir=$FMW_HOME/wlserver_10.3 -log=$FMW_HOME/utils/bsu/bsu_weblogic.log Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded ... .bea.plateng.patch.Patch.main(Patch.java:281) Can anyone explain me this and help me to solve this error?
asked Mar 27, 2020 LizzyM 6.1k points