plus.java
来自「在Java中实现数字的加、减、乘、除等运算。」· Java 代码 · 共 41 行
JAVA
41 行
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package calculatrice;/** * * @author Loïc */public class Plus extends Operateur { public void operer(Pile p){ int val1=0; int val2=0; if(p.estvide()==false){ val1=p.depiler(); val2=p.depiler(); p.empiler(val1+val2); } } public String afficher(){ return "+"; } public static void main(String args[]){ /*test de la methode operer*/ Pile p=new Pile(3); Plus pl=new Plus(); int res; p.empiler(1); p.empiler(2); pl.operer(p); res=p.depiler(); System.out.println(res);}}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?