| /home/chloe/ASDV-Java/Semester 2/Assignments/lab4_ChloeFontenot/src/main/java/com/chloefontenot/lab5_chloefontenot/lab5_ChloeFontenot.java |
/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.chloefontenot.lab5_chloefontenot; /** * * @author chloe */ public class lab5_ChloeFontenot { public static void main(String[] args) { //B b = new B("hi"); //A a = new A("msg1: The 2-parm constructor of A uses \"this\"", // "msg2: to call the 1-parm constructor of A "); //A a1 = new A(); //B b1 = new B(); //a.instanceMethod1(); //a.instanceMethod2(); //A.staticMethod(); //b.instanceMethod1(); //b.instanceMethod2(); //B.staticMethod(); //A a3 = new B(); //a3.instanceMethod1(); //testPolymorphism(a1); //testPolymorphism(b1); B b2 = (B) new A(); } public static void testPolymorphism(A a) { a.instanceMethod1(); } }