Click here to watch in Youtube :
https://www.youtube.com/watch?v=y-oMA--3BgQ&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Object Class(Assign subclass) |
public class Employee
{
String name;
}
public class Student
{
String name;
int age;
}
import java.util.ArrayList; public class ObjectClassTest { public static void main(String[] args) { Object objectRef = new Employee(); System.out.println(objectRef); objectRef = new Student(); System.out.println(objectRef); objectRef = new ArrayList<String>(); System.out.println(objectRef); objectRef = new String("John"); System.out.println(objectRef); } }
Employee@659e0bfd Student@2a139a55 [] John
https://sites.google.com/site/javaee4321/java/ObjectClassDemo_Assign_Subclass_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ObjectClassDemo_Assign_Subclass_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8fa82bcbf36a8ef675302adced6f7a0764627bd4/BasicJava/ObjectClassDemo_Assign_Subclass_App/?at=master
See also:
No comments:
Post a Comment