• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the error in below code?  RSS feed

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

why is there an error at the line battle10 obj=new battle10();
 
Greenhorn
Posts: 7
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First just let me say I am a total noob so if I'm wrong, someone else jump in please.

battle10 obj=new battle10();

My guess is that this line should look like this:

battle10 obj = new battle10();

I think there should be a space on each side of the = sign. That's all I got. Hope it helps.
 
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi radha,

If you UseCodeTags (← click) your program is going to much easier to read. Please edit your post and put code tags around the program.
 
Knute Snortum
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris Pow wrote:I think there should be a space on each side of the = sign. That's all I got. Hope it helps.


Spaces around operators is nice, but not required.
 
Knute Snortum
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
radha gogia wrote:
why is there an error at the line battle10 obj=new battle10();


For your next question, always post the error message.

But your problem is you can't see class batle10 from the first class. You can only see inner classes from the outer class.

Also, classes in Java should start with a capital letter: Battle10, Battle101. Ands it's very confusing to have a top-level class and an inner class named the same thing.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may I know what actually you are trying to achieve here ..

You are declaring one class battle10 that extends battle101 and again you have declared one inner class battle10 !!!.

Satya
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!