1 public class Number { 2 private int n1; 3 private int n2; 4 public Number(int n1,int n2){ 5 6 this.n1=n1; 7 this.n2=n2; 8 } 9 10 public void addition(){ 11 p(n1+n2); 12 } 13 public void subtration(){ 14 p(n1-n2); 15 } 16 public void multiplication(){ 17 p(n1*n2); 18 } 19 public void division(){ 20 21 p(n1/n2); 22 } 23 public void p(int n) 24 { 25 System.out.println(n); 26 } 27 28 29 30 } 31 ------------------------------------------------------------------- 32 public class Test { 33 34 public static void main(String[] args) { 35 // TODO Auto-generated method stub 36 Number n=new Number(4,2); 37 n.addition(); 38 n.subtration(); 39 n.multiplication(); 40 n.division(); 41 } 42 43 }