Abstract Methods:
Abstract Classes:
/**
* ABSTRACT CLASS
* /
public abstract class AbstractTest {
public abstract void testPrint1();
protected abstract void testPrint2();
}
/**
* ABSTRACT CLASS IMPLEMENTED
* NOTE: IMPL CLASS MUST IMPLEMENT ALL ABSTRACT METHODS IN ABSTRACT CLASS
*/
public class AbstractTestImpl extends AbstractTest {
public void testPrint1() {
System.out.println("Test Print One!");
}
public void testPrint2() {
System.out.println("Test Print Two!");
}
public static void main(String args[]) {
AbstractTestImpl obj = new AbstractTestImpl();
obj.testPrint1();
}
}
- They are present in abstract classes
- The keyword "abstract" is prepended to the methods
- Abstract methods are implemented only in sub-class / inherited class and not in "Abstract" class
- Since abstract methods are implemented in sub-class, the return type of abtract methods is either "protected" or "public"
Abstract Classes:
- A class that contains "abstract" methods is an abstract class
- Abstract classed can contain "non static" and "non final" member variables
- They can NEVER be instantiated. They can be ONLY INHERITED
- One abstract class can inherit another abstract class
- Abstract classes can contain ordinary methods as well as abstract methods
/**
* ABSTRACT CLASS
* /
public abstract class AbstractTest {
public abstract void testPrint1();
protected abstract void testPrint2();
}
/**
* ABSTRACT CLASS IMPLEMENTED
* NOTE: IMPL CLASS MUST IMPLEMENT ALL ABSTRACT METHODS IN ABSTRACT CLASS
*/
public class AbstractTestImpl extends AbstractTest {
public void testPrint1() {
System.out.println("Test Print One!");
}
public void testPrint2() {
System.out.println("Test Print Two!");
}
public static void main(String args[]) {
AbstractTestImpl obj = new AbstractTestImpl();
obj.testPrint1();
}
}
Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
ReplyDeletepython Training in Pune
python Training in Chennai
python Training in Bangalore
Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
ReplyDeleteBest Devops Training in pune
Devops Training in Bangalore
Power bi training in Chennai
I was looking for this certain information for a long time. Thank you and good luck.
ReplyDeleteData Science Training in Indira nagar
Data Science Training in btm layout
Data Science Training in Kalyan nagar
Data Science training in Indira nagar
Data science training in bangalore
Thank you for sharing such a informative information with us. Keep on sharing the blog like this Technical Writings.
ReplyDeletejava training in chennai
java training in tambaram
aws training in chennai
aws training in tambaram
python training in chennai
python training in tambaram
selenium training in chennai
selenium training in tambaram
Very well written blog and I always love to read blogs like these because they offer very good information to readers with very less amount of words....thanks for sharing your info with us and keep sharing.
ReplyDeleteweb designing training in chennai
web designing training in annanagar
digital marketing training in chennai
digital marketing training in annanagar
rpa training in chennai
rpa training in annanagar
tally training in chennai
tally training in annanagar
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletedata science training in chennai
data science training in velachery
android training in chennai
android training in velachery
devops training in chennai
devops training in velachery
artificial intelligence training in chennai
artificial intelligence training in velachery
Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart..
ReplyDeletesap training in chennai
sap training in omr
azure training in chennai
azure training in omr
cyber security course in chennai
cyber security course in omr
ethical hacking course in chennai
ethical hacking course in omr
First i got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks
ReplyDeletesap training in chennai
sap training in porur
azure training in chennai
azure training in porur
cyber security course in chennai
cyber security course in porur
ethical hacking course in chennai
ethical hacking course in porur
ReplyDeletehttps://ackimaging.com
Great post. keep sharing such a worthy information.
ReplyDeletecontent writing course in chennai
online content writing course
I cannot thank you enough for the blog.Thanks Again. Keep writing.
ReplyDeletecore java online course
core java online training
Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog.
ReplyDeletedata science course fee in hyderabad