This can be a confusing topic because one can argue that sharing method attributes between a super or abstract class with a derived class could be described by either Polymorphism or Inheritance. One significant differerence could be illustrated as to when or under what circumstances you would you use one or the other. An ideal instance of using Inheritance would be when you want to create an entirely new class, but wish to borrow a group of existing attributes or methods resident in an existing Abstract or super Class, instead of re-inventing the wheel. If you had an Abstract Class Carnivore and wanted to create a subclass Cat, you could instantly inherit all the methods that were common in Carnivore that applied to Cat without writing new code. Polymorphism could be best applied when you had an existing SubClass that you wanted to modify or add a feature that could borrow a method that existed in a higher class. Take the Cat subclass, which inherited attributes from Carnivore, and you wanted to add the method Stalk, which would generically describe how a carnivore approaches its prey. However its implementation in Cat would detail the stealth it uses that are unique to a Cat.
Unix is an operating system, Java is a language.
Rowset
Compile Time Polymorphism in Java is when you have the several methods with same name and different parameters and compiler has to decide how to select which method has to run based on the arguments hence the name Compile time polymorphism or method overloading.
difference between constant and static variables in java
Actually java is not purely object oriented.because we can use the primitive data types in Java.In java all those things or considered as classes and objects .So we are called java is an object oriented programming language...
Yes.
No. Interfaces in Java are a construct to get polymorphism ( subtype polymorphism ) working in Java, but they are not a "kind" of polymorphism. In polymorphism happens when two objects respond to the same message ( method call ) in different way ( hence poly -> many, morphism -> way or shape : polymorphism -> many ways). In Java to be able to send the same message to two different objects you have to either inherit the same parent, or implement the same interface.
They are different versions. Java 5 is newer than Java 2. Think of it like the difference between the Playstation 1 and the Playstation 3.
The main difference is that: neither of them are related to one another. They have nothing similar between them and are totally different. The only point here is that they are both used in Java which can be stated as a similarity. Inheritance is the feature wherein functionality from one class is available for another class. Polymorphism refers to the feature wherein the same entity exists as multiple items. Ex: method overriding, method overloading etc.
Java is object oriented, C is not...
kamina
kamina
Unix is an operating system, Java is a language.
Rowset
JAD-Java Application Description JAR-Java archive
java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.
Yes. Java is an Object Oriented Programming Language and it supports the OOPS concepts like Inheritance, Polymorphism etc