ABSTRACT CLASS AND METHOD IN JAVA PROGRAMMING
Abstraction is yet another important aspect of object oriented programming language. Think it as a really simple example, you might have send message from facebook to your friend, you just have to type text and then click send. You don't know the internal mechanism of how message is being sent. Abstraction means the same hiding details and showing only useful functionality to the user. This program is a simple demonstration of abstract class and method in java. There are two things that need to be kept in mind. First we can't create object of an abstract class and second the abstract method must be inside the abstract class.
package Polymorphism;
abstract class sum{
public abstract void displaysum();
}
class sumoftwonumber extends sum{
public void displaysum() {
System.out.println("Sum has been displayed");
}
}
public class AbstractClass {
public static void main(String[] args) {
sum obj=new sumoftwonumber();
obj.displaysum();
}
}
Here's the output of the above code.
Leave ABSTRACT CLASS AND METHOD IN JAVA PROGRAMMING to:
Read more #java posts
Best Posts From Leo Umesh
We have not curated any of leoumesh's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Leo Umesh
- The Tattoo of My Newborn Baby Girl Forever Inked on My Skin
- Long Weekend Food Feast With Wife
- String Manipulation in C#: Part 2
- String Manipulation in C#
- Introduction to C# and .NET
- Weekend Escape To Falls
- Evening Barbecue With Favourite Beer 🍺 🍻
- NumPy Broadcasting
- Summer BBQ
- Review of "The Day of The Jackal" Series
- Wonders of Wave Rock, Western Australia
- Trying To Make Authentic Chicken Dum Biryani At Home
- Beautiful Ocean Lookout in South West Australia
- Esperance: Hidden Paradise of Western Australia
- Cruising Through Blue Haven Beach
- My First Tattoo
- Exploring Flavoursome Veggie Indian Cuisines
- Australia's Popular Drink: Homemade
- An Everlasting Flowers
- Unexpected Rainbow At Wellington Dam, Western Australia