à®®ேலுà®®் பல புதிய டெக்னாலஜி பற்à®±ி தெà®°ிந்து கொள்ள, எங்கள் "டெக் டுப் தமிà®´் நாடு" யூட் டூஃப் சேனலை SUBSCRIBE செய்து கொள்ளவுà®®்.

Breaking

Sunday 8 October 2017

OOPS in JAVA 19


OOPS in JAVA 19

Abstract class in Java

If a class contain any abstract method then the class is declared as abstract class. It can have abstract and non-abstract methods (method with body).

Abstraction in Java:

Abstraction is a process of hiding the implementation details and showing only functionality to the user. Abstraction lets you focus on what the object does instead of how it does it.

Abstraction in Java:

1. Abstract class (0 to 100%)

2. Interface (100%)

Abstract class:

A class that is declared as abstract is known as abstract class. It needs to be extended and its method implemented. It cannot be instantiated.

Syntax:

abstract class class_name {

}


Abstract method:

Method that are declared without any body within an abstract class is known as abstract method. Any class that extends an abstract class must implement all the abstract methods declared by the super class.

Syntax:

abstract return_type function_name ( );    // No definition

NOTE: Instead of curly braces({ }) an abstract method will have a semicolon( ; ) at the end.

Example  of Abstract class

abstract class A
{
 abstract void callme(); 
}
class B extends A
{
 void callme()
 {
  System.out.println("this is callme."); 
 }
 public static void main(String[] args)
 {
  B b=new B();
  b.callme();
 }
}
Output : this is callme.

Points to Remember:

1. Abstract classes are not Interfaces. They are different, we will study this when we will study Interfaces.

2. An abstract class must have an abstract method.

3. Abstract classes can have Constructors, Member variables and Normal methods.

4. Abstract classes are never instantiated.

5. When you extend Abstract class with abstract method, you must define the abstract method in the child class, or make the child class abstract.


When to use Abstract Methods & Abstract Class??

Ans) Abstract methods are usually declared where two or more subclasses are expected to do a similar thing in different ways through different implementations. These subclasses extend the same Abstract class and provide different implementations for the abstract methods.


No comments:

Post a Comment

Hai , Post your comment . (required, Bugs, Errors )

You need to see


SUBSCRIBE NOW



Backlinks : Website Design Company in Coimbatore
Website Design Company in Tamil nadu
Website Design Company in Karur
Website Design Company in Erode
Website Design Company in ooty
Website Design Company in theni
Website Design Company in thoothukudi
Website Design Company in Chennai
Website Design Company in Sathy
Website Design Company in Coimbatore Tamilnadu
Cheap Website Design Company in Coimbatore
Adsense Website Design Company in Coimbatore
ecommerce Website Design Company in Coimbatore
school Website Design Company in Coimbatore
Academy Website Design Company in Coimbatore
Test Website Design Company in Coimbatore
Best Website Design Company in Coimbatore
Adsense Website Design Company in Coimbatore
Adsense Website Design Company in Tamil nadu
Adsense Website Design Company in Karur
Adsense Website Design Company in Erode
Adsense Website Design Company in ooty
Adsense Website Design Company in theni
Adsense Website Design Company in thoothukudi
Adsense Website Design Company in Chennai
Adsense Website Design Company in Sathy
Free SEO Tools online
Free SEO Tools online Website
Free SEO Tools online Plagiarism
Free SEO Tools online article rewriter tool
Free SEO Tools online article reading and writing criticism
Free SEO Tools online seo backlink
Free SEO Tools online Free backlink maker
Free SEO Tools online seo backlink strategy
Free SEO Tools online content writting
360 help SEO Tools online Plagiarism checker
360 help SEO Tools online seo backlink
360 help SEO Tools online Free backlink maker
360 help SEO Tools online content writting
360 help SEO Tools online article rewriter tool
360 help SEO Tools
360 help SEO Tools India
360 help SEO Tools Tamil
360 help SEO Tools website