java初学,谁给看一下为什么不对啊,另外此类该如何使用Junit测试
package com.li.test;class Math
{
private int no1;
private int no2;
private int no3=0;
public void Sum()
{
no3=this.getNo1()+this.getNo2();
System.out.println("Sum "+this.getNo1()+" + "+this.getNo2()+" = "+no3);
}
public void Sub()
{
no3=this.getNo1()-this.getNo2();
System.out.println("Sub "+this.getNo1()+" + "+this.getNo2()+" = "+no3);
}
public void Mul()
{
no3=this.getNo1()*this.getNo2();
System.out.println("Mul "+this.getNo1()+" + "+this.getNo2()+" = "+no3);
}
public void Div()
{
if (this.getNo2()!=0)
no3=this.getNo1()/this.getNo2();
System.out.println("Div "+this.getNo1()+" + "+this.getNo2()+" = "+no3);
}
public void setNo1(int a)
{
no1=a;
}
public void setNo2(int b)
{
no2=b;
}
public int getNo1()
{
return no1;
}
public int getNo2()
{
return no2;
}
}
public class Add {
public void main(String args[]){
// int a=0,b=0;
// System.in(a,b);
Math math=new Math();
math.setNo1(10);
math.setNo2(5);
math.Sum();
math.Sub();
math.Mul();
math.Div();
}
}