BIG
DATA

JAVA

Java Blog Index

Read more about »
  • Java 9 features
  • Read about Hadoop
  • Read about Storm
  • Read about Storm
 

What is the difference between up-casting and down-casting with respect to class variable?

Up-casting is casting to a supertype, while downcasting is casting to a subtype. Upcasting and downcasting gives us advantages, like Polymorphism or grouping of different objects....


Difference between Child c = new Child(); and Parent p =new Child();

Up-casting and down-casting are great way of implementing polymorphism in your design. It is called as up-casting. Object 'p' has limited access. It can only access parent class properties, because p is a refernce to parent class.....


Why use List list = new ArrayList instead of ArrayList list = new ArrayList?