Here is my package arithmatic inside which a file called arith.java
package arithmatic;
public class arith{
public int add(int a, int b){
return(a+b);
}
}
and outside the arithmatic package a file packagedemo.java
import arithmatic.*;
public class packagedemo{
public void disp(int a, int b){
System.out.println("Addition is : "+ add(a, b));
}
public static void main(String args[]){
packagedemo pd=new packagedemo();
pd.disp(20,10);
}
}
after compiling it gives me error as,
packagedemo.java:6: cannot find symbol
symbol : method add(int,int)
location: class packagedemo
System.out.println("Addition is : "+ add(a, b));
I really dont understand why this error occurs any solution please?