Hi, i tried a class with abstract modifier without declaring any abstract methods.It's working.then what is the use of Abstract there. it is also possible to define constructors for abstract classes.but we don't create objects to Abstract classes.then why?
You can declare a class abstract but still have non-abstract methods and constructors in it.
It's very useful because you could define a certain set of behaviors, but leave one or more behaviors undefined. You would then have to create a concrete subclass that defined the behaviors that the superclass didn't if you want to create an instance of it, but they would inherit the behavior(s) that the superclass defined.
You can define a class as abstract because you don't want anyone to instantiate it (because it really is not a "mature" class).
At the same time, you can define default implementations for ALL the methods. A class that subclasses this class isn't forced to override anything specific. Nevertheless, it is IMPLIED (but not required) that some methods, but any specific methods SHOULD be overridden.