\Work\Foo\shapes\model \Work\Foo\shapes\test
package model; /** Minimal Circle */ public class Circle { private int radius; public Circle(int aRadius) { this.radius = aRadius; } public String toString() { return "Circle with radius = " + this.radius; } }
package test; import model.Circle; public class CircleTest { public static void main(String[] args) { CircleTest test = new CircleTest(); test.test1(); test.test2(); } public void test1() { Circle circ = new Circle(3); System.out.println(circ.toString()); } public void test2() { Circle circ = new Circle(10); System.out.println(circ.toString()); } }
ECHO OFF REM Place this script into your classpath directory REM "." Means current directory (script is in classpath dir) REM We could also replace "." with absolute path to our classpath dir javac -cp "." "model\Circle.java" javac -cp "." "test\CircleTest.java" PAUSE
ECHO OFF REM Place this script into your classpath directory REM "." Means current directory (script is in classpath dir) REM We could also replace "." with absolute path to our classpath dir java -cp "." test.CircleTest PAUSE