0

Whats that, error «identifier» expected??

can't solve the error I'm new to java so plz do the needfull.

26th Jun 2017, 2:56 AM
Anuj singh
Anuj singh - avatar
8 Réponses
+ 2
identifier is basically a name. int x; x is the identifier, and once I wrote int the compiler was expecting one, As the identifier comes after the variable type. Similar thing with methods, before the parameters an identifier, or name of the method is expected. void methodName (){ }
26th Jun 2017, 3:02 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
I was just explaining the error, the examples weren't meant to be the same issue your having. Can You post the code here? Maybe then I can point out the problem directly.
26th Jun 2017, 3:09 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
That code works for me. Make sure there's no extra code somewhere. Maybe outside the class?
26th Jun 2017, 3:29 AM
Rrestoring faith
Rrestoring faith - avatar
+ 1
Remove the "uctor" part. Not sure what thats supposed to be.
26th Jun 2017, 3:19 AM
Rrestoring faith
Rrestoring faith - avatar
0
actually I was getting the error in a rect program
26th Jun 2017, 3:04 AM
Anuj singh
Anuj singh - avatar
0
how can I post the code over here
26th Jun 2017, 3:10 AM
Anuj singh
Anuj singh - avatar
0
class Rect { int length,breadth; Rect(int l,int b) uctor { length=l; breadth=b; } public static void main(String args[]) { Rect r =new Rect(4,5); Rect r1= new Rect(6,7); System.out.println("Area:"+(r.length*r.breadth)); System.out.println("Area:"+(r1.length*r1.breadth)); } }
26th Jun 2017, 3:16 AM
Anuj singh
Anuj singh - avatar
0
still getting 6 error
26th Jun 2017, 3:24 AM
Anuj singh
Anuj singh - avatar