Use Java class from another class
examples/mymath/Calculator.java
public class Calculator { public static Integer add(Integer a, Integer b) { if (a == 10) { return 10; } return a+b; } }
examples/mymath/UseCalc.java
public class UseCalc { public static void main(String[] args) { Number a = Calculator.add(2, 3); System.out.println(a); Number b = Calculator.add(10, 3); System.out.println(b); } }
cd examples/mymath rm -f *.class; javac Calculator.java UseCalc.java ; java UseCalc