001 002 import MyPackage.*; 003 004 /** 005 * Inherit from a class in another package and access a protected field within 006 * the super class should be possible. 007 * 008 * @author Kristian Torp, torp (at) cs (dot) aau (dot) dk 009 * @version 1.0 010 */ 011 public class SubClassExercise6_15 extends Exercise6_15 { 012 public SubClassExercise6_15() { 013 System.out.println("Making subclass"); 014 } 015 016 public void setX(int x) { 017 this.x = x; 018 } 019 020 public static void main(String args[]) { 021 SubClassExercise6_15 cl = new SubClassExercise6_15(); 022 System.out.println(cl); 023 cl.setX(15); 024 System.out.println(cl); 025 } 026 }