package a.foods; public class Fruit { public String toString() { return "I am a fruit!"; } }
package a.foods; public class Vegetable { public String toString() { return "I am a vegetable!"; } }
package a.places; public class Continent { public String toString() { return "I am a continent (larger type of place)!"; } }
package a.places; public class City { public String toString() { return "I am a city."; } }
package b.geography; public class Mountain { public String toString() { return "There is nothing more attractive than a mountain!"; } }
package b.geography; public class River { public String toString() { return "Rivers are so beautiful"; } }
package tests; import a.foods.Fruit; import a.foods.Vegetable; import a.places.Continent; import a.places.City; import b.geography.River; import b.geography.Mountain; public class Play { public static void main(String[] args) { Play player = new Play(); player.go(); } public static void println(Object o) { System.out.println(o != null ? o.toString() : ""); } public void go() { Fruit banana = new Fruit(); println(banana); Vegetable kale = new Vegetable(); println(kale); Continent africa = new Continent(); println(africa); City tokyo = new City(); println(tokyo); Mountain westBond = new Mountain(); println(westBond); River yangtze = new River(); println(yangtze); } }
echo off javac -classpath "." a/foods/*.java javac -classpath "." a/places/*.java javac -classpath "." b/geography/*.java javac -classpath "." tests/Play.java pause
echo off java -classpath "." tests/Play pause