• Post Reply Bookmark Topic Watch Topic
  • New Topic

what are the error in the following program?  RSS feed

 
Jayanth Nanduri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//superclass
1)

2) //superclass

 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jayanth and welcome to the Ranch!

When you post code, please UseCodeTags (that a link).  It makes the code much easier to read and people are more likely to help.  I'll do it for you this time.

What error are you getting?  Can you post the full error message?
 
Jayanth Nanduri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:Hi Jayanth and welcome to the Ranch!

When you post code, please UseCodeTags (that a link).  It makes the code much easier to read and people are more likely to help.  I'll do it for you this time.

What error are you getting?  Can you post the full error message?


thank you so much....it is my assignment to find errors in the following code.
i believe that the private variables cannot be used in subclasses.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayanth Nanduri wrote:what are the error in the following program?


Well, since in these cases, these are compiler errors; the easiest way to determining the errors, are obviously to use the compiler.

Henry
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can read about how to setup your computer for your first program here.

Hint: Java syntax is case-sensitive.
 
Jayanth Nanduri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we use the above code without a main method?

and for the second program i got a answer ,but not sure is there anything i left unnoticed in the second program
Answer for 2) :
In the Sub class getMilesperGallon() method the datatype of mpg should be of double.
A class must declare abstract if it has any abstract methods
Expands is wrong,expand is replaced with extends

 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayanth Nanduri wrote:can we use the above code without a main method?

If by "use" you mean "execute", then no.  Why do you need to execute the program?  You can compile without executing.

and for the second program i got a answer ,but not sure is there anything i left unnoticed in the second program
Answer for 2) :
In the Sub class getMilesperGallon() method the datatype of mpg should be of double.
A class must declare abstract if it has any abstract methods
Expands is wrong,expand is replaced with extends

I don't see those errors in the code you posted.  Did you copy and paste or retype?
 
Jayanth Nanduri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i edited expands to extends
thatsit rest all is the code with errors...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!