Programming in Java
Object Oriented in Java
Advanced topics in Java
Modal Box
Tutorials
C is a very powerful and widely used language. It is used in many scientific programming situations. It forms (or is the basis for) the core of the modern languages Java and C++. It allows you access to the bare bones of your computer.C++ is used for operating systems, games, embedded software, autonomous cars and medical technology, as well as many other applications. Don't forget to visit this section...
Java Abstract class
In java abstract class is a partial implementation of abstraction while interface is implementation of full abstraction. Abstract class is declared with keyword abstract before
Abstract class may have both abstract as well as non abstract methods.
- Abstract class may not be intialized
- Abstract class is used after inheriting it
- in sub class all abstract methods of abstract class has to be override.
- Abstract method also defined with abstract keyword and function overloading may also be done in abstract class.
Abstract class example.
abstract class worker { void nonAbsMethod(String msg) { System.out.println("Msg in non asbtract method"+msg); } abstract void getPayment(int a); abstract void getPayment();
}
class employee extends worker
{ void subClassMethod() { System.out.println("sub class method "); } void getPayment(int a)
{ System.out.println("Payment Given "+a); }
void getPayment()
{ System.out.println("Default Payment 10000"); } } class checkMain
{
public static void main(String args[])
{
// wroker w1= new worker(); we can not create the object of abstract class.
employee e1= new employee();
e1.nonAbsMethod("Hi Hello");
e1.subClassMethod();
e1.getPayment(15000);
e1.getPayment();
}
}
Output of the above program is as following.
Video/ C Introduction
Watch video in full size