
public class Add{ int foo=7; int bar=8; public int add(int x,int y){ int z=x+y; System.out.println(z); return z; }//add public static void main(String []s){ Add a1=new Add(); a1.add(7,8); Add a2=new Add(); a2.add(foo,bar); }//main }//class

public class Add{
static int foo=7;
static int bar=8;
public int add(int x,int y){
int z=x+y;
System.out.println(z);
return z;
}
public static void main(String []s){
Add a1=new Add();
a1.add(7,8);
Add a2=new Add();
a2.add(foo,bar);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.