public class Math {
public static void main(String args[]){
MyMath a = new MyMath();
long Result = a.add(5L, 6L);
long Result2 = a.sub(5L, 6L);
long Result3 = a.mul(5L, 6L);
double Result4 = a.div(5L, 6L);
System.out.println("Result, Add : "+Result);
System.out.println("Result, Subtract : "+Result2);
System.out.println("Result, Multiply : "+Result3);
System.out.println("Result, Divede : " +Result4);
}
}
static class MyMath{
long add(long a, long b){
return a+b;
}
long mul(long a, long b){
return a*b;
}
long sub(long a, long b){
return a-b;
}
double div(double a, double b){
return a / b;
}
}
Main.java:1: class Math is public, should be declared in a file named Math.java
public class Math {
^
Main.java:22: modifier static not allowed here
static class MyMath{
^
2 errors
댓글 0