What is an abstract method?
Regards,
Rajan.
<snip />
What is an abstract method?
Regards,
Rajan.
<snip />
Correction:We do have a place here where Java questions can go, and that’s in the General Web Development & Application Design Issues forum. I’ll move this thread over there right now.
An abstract method is the same in Java, C++, etc.
It’s basically a method which someone has specified needs to be there, but they don’t implement it themselves. You usually take the class that has the abstract method, extend it, then define your function.
For example, let’s say we have a class called Pet, and it has a method called Action. The Pet itself doesn’t do anything with that action, so I’ll mark it as abstract.
public abstract class Pet {
abstract public void Action();
}
With an abstract method, I can’t create an instance of Pet.
However, now I want to define a Dog, using Pet.
public class Dog extends Pet {
public void Action() {
System.out.println("Bark");
}
}
Now Dog has his own Action, and because there are no abstract methods, I can create a new Dog.
I am new in Java and started my career in java. Facing problem for inserting ids of multiple categories. Help me out…
one per row