Tuesday, 18 March 2025

Contact Info

  • ADDRESS: 851, LG, Sector 3F, Sector 3, Vaishali, Ghaziabad, Uttar Pradesh 201010

  • PHONE: +91 7986794481

  • E-MAIL: contact@technicalspeaks.com

  • Home  
  • Abstraction | Java Abstraction OOPs | Abstract Class and Method
- core java

Abstraction | Java Abstraction OOPs | Abstract Class and Method

Java Abstraction — Abstraction in JAVA “shows” only the essential attributes and “hides” unnecessary details of the object from the user.— In Java, abstraction is accomplished using Abstract classes, Abstract methods, and interfaces.— Abstraction helps in reducing programming complexity and effort. WATCH VIDEO: Abstract Class: — A class which is declared “abstract” is called as an abstract […]

Java Abstraction

— Abstraction in JAVA “shows” only the essential attributes and “hides” unnecessary details of the object from the user.
— In Java, abstraction is accomplished using Abstract classes, Abstract methods, and interfaces.— Abstraction helps in reducing programming complexity and effort.

WATCH VIDEO:

Abstract Class:

— A class which is declared “abstract” is called as an abstract class.
— It can have abstract methods as well as concrete methods.
— A normal class cannot have abstract methods.

Abstract Method:

— A method without a body is known as an Abstract Method

— It must be declared in an abstract class.
— The abstract method will never be final because the abstract class must implement all the abstract methods.

Abstraction Java Program:

abstract class Animal {
public abstract void animalSound();
public void sleep() {
System.out.println(“Zzz”);
}
}
class Pig extends Animal {
public void animalSound() {
System.out.println(“The pig says: wee wee”);
}
}
class MyAbstractClass {
public static void main(String[] args) {
Pig myPig = new Pig();
myPig.animalSound();
myPig.sleep();
}
}

Output: The pig says: wee wee , and Zzz

Java Abstraction OOPs

Connect with us:

Leave a comment

Your email address will not be published. Required fields are marked *

About Us

Providing expert blogs on web, SEO, tech, YouTube, and more, helping readers stay updated and grow in the digital world.

Email Us: contact@technicalspeaks.com

Contact: +91 7986794481

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!