Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

down casting java

public class Fruit{}  // parent class
public class Apple extends Fruit{}  // child class

public static void main(String args[]) {
    // The following is an implicit upcast:
    Fruit parent = new Apple();
    // The following is a downcast. Here, it works since the variable `parent` is
    // holding an instance of Apple:
    Apple child = (Apple)parent;
}
Comment

PREVIOUS NEXT
Code Example
Java :: custom dialog in android 
Java :: java 14 switch 
Java :: JAVA Multi-line Comment 
Java :: java final variable 
Java :: what is stringbuilder used for in java 
Java :: array index out of bound exception in java 
Java :: java switch statement 
Java :: search in rotated sorted array leetcode 
Java :: get selected item spinner 
Java :: java log4j example 
Java :: Java Add elements to a HashMap 
Java :: generate hash in java 
Java :: zoneddatetime java 
Java :: array to array list java 
Java :: java byte data type 
Java :: java decler variabel 
Java :: spring boot prerequisites 
Java :: java map sorted by key 
Java :: spring security controlleradvice 
Java :: lopping rows rethinkdb 
Java :: labeled statement in java ex 
Java :: android sqlite insert or replace 
Java :: @embeddedid 
Java :: intergers are appearing as string in Json 
Java :: android open app info programmatically 
Java :: java mcq test 
Java :: java Least prime factor of numbers till n 
Java :: java try-with-resources nested streams 
Java :: java equals on recursive apache commons 
Java :: Composite foreign keys as primary key jpa 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =