Inheritance. casting and polymorphism in java -


can please explain me how implement these these types of code , explan difference between 3 are? coding in java.

i'm goign take shot @ because tried understand , way see if did :) because if can't explain haven't understood :)

casting simple. means pretty convert value or object of type different type. way can example turn float integer

float y = 7.0 int x = (int) y 

x 7. of course can't cast type other type. there limitations should search on google - never cover of them.

polymorphism sounds similar else. understand it means objects can of multiple types. example of have class extends class instance of parent class can of type of derived class.

class base {...}  class derived extends base {...}   base obj1 = new base(); derived obj2 = new derived();  obj1 = obj2; 

over course of snippet obj1 have been instance of base first instance of derived class derived base. possible because instances of derived classes contain "inner object" (i don't know official name) of base class. when cast base instance instance of derived "inner object"

hope helps


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -