• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of abstract keyword

 
leela krishhna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abstract class Foo
{

}

What is the use of abstract key word at here,
even though i am not declare any method in this class..
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The abstract keyword works just the same for this class as for any other abstract class. I suspect you already know what the keyword means, so you'll know what it means in this case too. The compiler won't let you create an instance of the Foo class.

But were you asking why you would want to do that? All I can say is, it's legal in Java to do so. If you want to know why somebody declared a class with no methods to be abstract, you'd have to ask them.
 
drac yang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the use is all there is to it, indicating the class Foo itself is abstract

maybe it would be used the same as the marker interface. nevertheless it's the marker abstract class. maybe.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only difference is, you can't create instances of class Foo directly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic