Wednesday, February 4, 2015
Like the article?
Polymorphism
We are going to create four Java class in our Polymorphism class. Those are:
1. human.java class
2. women.java class
3. men.java class
4. main.java class
Polymorphism Classes |
The codes are given below.
1. human.java
package polymorphism; /* What is polymorphism ? Answer: Coming out in different form when needed is called polymorphism. Polymorphism is a OOP ( Object Oriented Programming concept ). In more words, Java's polymorphism means the ability of Java's ability utilize objects depending on their particular data type and class. This is my super class. */ public class human { public void goodPublic(){ System.out.println(" In java human class " + "im printing good human method to understand polymorphism"); } }
2. women.java
package polymorphism; // This is my subclass public class women extends human{ public void goodPublic(){ System.out.println("This is a method printed output from WOmen class"); } }
3. men.java
package polymorphism; // this is my subclass public class men extends human { public void goodPublic(){ System.out.println("This is a method printed output from men class"); } }
4. main.java
package polymorphism; public class main { public static void main(String[] args) { /* Creating object of human class using inheritance OOP concept! We can create object as below using the inheritance as those sub class inherits human super class. In Below, meHuman,goodMen,goodWomen are reference variable. human is working as data type. */ human meHuman = new human(); human goodMen = new men(); human goodWomen = new women(); /* Now I'm going to create a Polymorphism array below of the super class and put the subclass objects there. */ human[] polymorphicArray = new human[3]; polymorphicArray[1] = new women(); polymorphicArray[2] = new men(); polymorphicArray[3] = new human(); // Printing those methods from subclass polymorphicArray[1].goodPublic(); polymorphicArray[2].goodPublic(); /* Here, this array is a array of polymorphism. This array has the ability to utilize objects differently depending on data type or class. */ } /* In final words, if u call a animal Sound super class and cat, dog subclass. no matter what the animal is working with the animal sound will return you the real animal sound. so, animal sound method is working as cat sound once and dog sound once. That's the different form! That's called polymorphism. */ }Overriding: In inherited subclass, if a method uses same name as the method declared in super class but the different method body is called as overriding.
Overloading: In inherited subclass, if a method uses same name as the method declared in super class but the different method body and different arguments is called as Overloading.
Read More: What are actually taught in computer science and Engineering ( CSE ) ?
RELATED POSTS
Subscribe to:
Post Comments (Atom)
Search
Powered by Blogger.
Contact with Rubel
Popular Articles
Tags
- About Me
- admob
- advice
- Android
- Android Development
- android help
- Android SDK set Up
- Android Studio
- Apps development
- Artcell
- bluehost
- body building
- Can't you make your body building at home?
- Career
- career opportunities
- Coding
- coding problem
- computer science and engineering
- cse
- CSS
- css tricks
- Differences Between Programmers and Coders
- Do you really need to go at Gym?
- Do you really need to go to Gym for having a good shaped body?
- Education
- engineering
- Error
- experience sharing
- fitness center
- Free templates
- good life advice
- google adsense
- google adsense success
- google play
- google play account open
- gym
- hostgator
- How can I get a Google Adsense account
- How to be a freelance
- How to develop android application
- how to develop mobile application
- how to earn money online
- how to make money online
- how to monetize mobile application
- HTML
- HTML/CSS
- Java Tutorial
- Lifestyle
- Linux
- Linux Os
- making money online
- Mobile Application Development
- mosharrof rubel
- noakhali zilla school
- online earning tips
- online earning ways
- phonegap
- Phonegap problem
- Programming
- r cannot be resolved to a variable type
- rubel
- software engineering
- southeast university
- Templates
- Ubuntu
- Ubuntu Help
- web hosting buy
- web hosting reseller
- why computer science?
- wordpress theme
Techonlogy
Subscribe Here
Label
- About Me
- admob
- advice
- Android
- Android Development
- android help
- Android SDK set Up
- Android Studio
- Apps development
- Artcell
- bluehost
- body building
- Can't you make your body building at home?
- Career
- career opportunities
- Coding
- coding problem
- computer science and engineering
- cse
- CSS
- css tricks
- Differences Between Programmers and Coders
- Do you really need to go at Gym?
- Do you really need to go to Gym for having a good shaped body?
- Education
- engineering
- Error
- experience sharing
- fitness center
- Free templates
- good life advice
- google adsense
- google adsense success
- google play
- google play account open
- gym
- hostgator
- How can I get a Google Adsense account
- How to be a freelance
- How to develop android application
- how to develop mobile application
- how to earn money online
- how to make money online
- how to monetize mobile application
- HTML
- HTML/CSS
- Java Tutorial
- Lifestyle
- Linux
- Linux Os
- making money online
- Mobile Application Development
- mosharrof rubel
- noakhali zilla school
- online earning tips
- online earning ways
- phonegap
- Phonegap problem
- Programming
- r cannot be resolved to a variable type
- rubel
- software engineering
- southeast university
- Templates
- Ubuntu
- Ubuntu Help
- web hosting buy
- web hosting reseller
- why computer science?
- wordpress theme
Sponsor
Categories
- About Me
- admob
- advice
- Android
- Android Development
- android help
- Android SDK set Up
- Android Studio
- Apps development
- Artcell
- bluehost
- body building
- Can't you make your body building at home?
- Career
- career opportunities
- Coding
- coding problem
- computer science and engineering
- cse
- CSS
- css tricks
- Differences Between Programmers and Coders
- Do you really need to go at Gym?
- Do you really need to go to Gym for having a good shaped body?
- Education
- engineering
- Error
- experience sharing
- fitness center
- Free templates
- good life advice
- google adsense
- google adsense success
- google play
- google play account open
- gym
- hostgator
- How can I get a Google Adsense account
- How to be a freelance
- How to develop android application
- how to develop mobile application
- how to earn money online
- how to make money online
- how to monetize mobile application
- HTML
- HTML/CSS
- Java Tutorial
- Lifestyle
- Linux
- Linux Os
- making money online
- Mobile Application Development
- mosharrof rubel
- noakhali zilla school
- online earning tips
- online earning ways
- phonegap
- Phonegap problem
- Programming
- r cannot be resolved to a variable type
- rubel
- software engineering
- southeast university
- Templates
- Ubuntu
- Ubuntu Help
- web hosting buy
- web hosting reseller
- why computer science?
- wordpress theme
Chiefs vs Falcons
ReplyDeleteChiefs vs Falcons live
nfl game pass
nfl live
live nfl
live nfl on cbs
Lions vs Saints
Lions vs Saints live
nfl game pass
nfl live
live nfl
live nfl on cbs
Rams vs Patriots
Rams vs Patriots live
nfl game pass
nfl live
live nfl
live nfl on cbs
Broncos vs jaguars
Broncos vs jaguars live
nfl game pass
nfl live
live nfl
live nfl on cbs
Texans vs Packers
Texans vs Packers live
nfl game pass
nfl live
live nfl
live nfl on cbs
Eagles vs Bengals
ReplyDeleteEagles vs Bengals live
nfl game pass
nfl live
live nfl
live nfl on cbs
Dolphins vs Ravens
Dolphins vs Ravens live
nfl game pass
nfl live
live nfl
live nfl on cbs
Bills vs Raiders
Bills vs Raiders live
nfl game pass
nfl live
live nfl
live nfl on cbs
49ers vs Bears
49ers vs Bears live
nfl game pass
nfl live
live nfl
live nfl on cbs
Giants vs Steelers
Giants vs Steelers live
nfl game pass
nfl live
live nfl
live nfl on cbs
Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information. I would like to suggest your blog in my dude circle.
ReplyDeleteBest Dental Clinic In Vellore
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.
ReplyDeleteOracle training in pune
Oracle Online Training
Oracle training in Bangalore
Oracle training in chennai
Oracle training in Tambaram
Oracle training in Sholingaanallur
Oracle training in marathahalli
Oracle training in btm
Oracle Online Training
Good post and well explained about the topic.thank you for sahring.keep blogging
ReplyDeleteHadoop Admin Training Institute
Hadoop Admin Training in Bangalore
hadoop admin institutes in bangalore
Thank you so much for the great and very beneficial stuff that you have shared with the world.
ReplyDeleteHadoop Training in Bangalore
Hadoop Courses in Bangalore
Hadoop Classes in Bangalore
Hadoop Training Institute in Bangalore
Hadoop Course Syllabus
Best Hadoop Training
Hadoop Training Centers
Smm Panel
ReplyDeleteSmm Panel
iş ilanları
İnstagram takipçi satın al
HİRDAVATCİ
beyazesyateknikservisi.com.tr
servis
tiktok para hilesi indir
çekmeköy daikin klima servisi
ReplyDeleteataşehir daikin klima servisi
beykoz beko klima servisi
tuzla beko klima servisi
çekmeköy lg klima servisi
ataşehir lg klima servisi
çekmeköy alarko carrier klima servisi
ataşehir alarko carrier klima servisi
pendik lg klima servisi
en son çıkan perde modelleri
ReplyDeleteminecraft premium
en son çıkan perde modelleri
uc satın al
lisans satın al
yurtdışı kargo
nft nasıl alınır
özel ambulans