?? mysecond.java
字號:
package tr2;
public class Mysecond {
float op1;
float op2;
char opr;
float result;
public void calculate(){
switch (this.opr)
{
case'+':
{this.result=this.op1+this.op2;
break;
}
case'-':
{this.result=this.op1-this.op2;
break;
}
case'*':
{
this.result=this.op1*this.op2;
break;
}
case'/':
{
if(this.op2==0)
System.out.println("error");
else
this.result=this.op1/this.op2;
}
}
}
public static void main(String args[])
{
Mysecond p=new Mysecond();
p.op1=12;
p.op2=13;
p.opr='*';
p.calculate();
System.out.println(p.result);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -