This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes about abstract method and class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about abstract method and class" Watch "about abstract method and class" New topic

about abstract method and class

y bin

Joined: Feb 18, 2004
Posts: 4
I want to determine if the following is correct.
Anybody could discuss it with me?

1,the abstract method's announce need not {} ?
but the abstract method in the abstrct class may have contents({})

2, the abstrct class can't be instantiated, how can I say it has constructor? what is the construtor use?
Leo Deegan

Joined: Jun 15, 2004
Posts: 12
Hey there, y.

1. An abstract method cannot have a block for its body (that is, it can only use a semicolon and cannot use { }).

2. An abstract class can be instantiated, provided its abstract methods are implemented when the class is instantiated. For instance,

public abstract class Abc {
public astract boolean foo();

can be instantiated like this:

Abc abc =
new Abc() {
public boolean foo() {
return false;

One reason for providing a constructor for an abstract class is that its subclasses may take advantage of the constructor.
I agree. Here's the link:
subject: about abstract method and class
It's not a secret anymore!