• Post Reply Bookmark Topic Watch Topic
  • New Topic

abstract class  RSS feed

 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The prof. ask us to use abstract class for this kind of program but it seem that i can't test it.
this is my java program



and the error that i have is here





 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and what exactly is the error you are getting?
 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this kind of error and i already indicated with the arrow (=>)

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
c cannot be resolved to a type
Cannot instantiate the type Cylinder

at oops.Test.main(Test.java:53)
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the error that i have is here . . .

What error and where exactly? In order to get the best answer(s) you need to be specific about the problem you're facing and TellTheDetails.

Besides the fact that the code you provided cannot be compiled (as such), the only detail I can see being wrong for now is that you try to instantiate an object of abstract class, so I would recommend you read this.
 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the only that it seem for me to work only using the abstract only in point and just leave the circle and cylinder without a abstract
in which will look like this
output is this
3.141592653589793
Please select from the menu below
1. Instantiate a Circle
3. Instantiate a Cylinder
Enter your choice

i guess i can only use abstract in parent or the head of the class which is the Point
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you understand the concept and purpose of abstract classes?
 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kemal Sokolovic wrote:Do you understand the concept and purpose of abstract classes?

I think im not familiar with that yet, perhaps can you explain it
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you might review the tutorial I gave you in the previous post. Also similar topics were covered couple of times here at the forum, so if you search a bit you can find a lot of information (like this).
 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kemal Sokolovic wrote:Well, you might review the tutorial I gave you in the previous post. Also similar topics were covered couple of times here at the forum, so if you search a bit you can find a lot of information (like this).


thank you for the link
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!