public class Calc {
public static void main(String[] args) {
int a = 10; int b = 2;
int total = tasu(a, b);
int delta = hiku(a, b);
System.out.println("When added" + total + ", Pull" + delta);
}
public static int tasu(int a, int b) {
return (a + b);
}
public static int hiku(int a, int b) {
return (a - b);
}
}
Split files with main (), tase (), haiku ()
public class Calc {
public static void main(String[] args) {
int a = 10; int b = 2;
int total = CalcLogic.tasu(a, b);
int delta = CalcLogic.hiku(a, b);
System.out.println("When added" + total + ", Pull" + delta);
}
}
Will not load unless CalcLogic.
is added
public class CalcLogic {
public static int tasu(int a, int b) {
return (a + b);
}
public static int hiku(int a, int b) {
return (a - b);
}
}
Move tase (), haiku ()
Recommended Posts