Java examples for Object Oriented Design:Inheritance
A Test Class to Demonstrate field's Inheritances
class MySuper {//from w w w . j av a 2 s . co m protected int num = 100; protected String name = "Edith"; } class MySub extends MySuper { public void print() { System.out.println("num: " + num); System.out.println("name: " + name); } } public class Main { public static void main(String[] args) { MySub fhSub = new MySub(); fhSub.print(); } }