import javax.microedition.lcdui.*; public class d1 extends Form implements CommandListener { TextField tf = new TextField("a", "", 500, 2); TextField tf1 = new TextField("b", "", 500, 2); Command back = new Command("trở lại", 7, 1); Command cong = new Command("cộng", 4, 1); double a = Double.parseDouble(tf.getString()); double b = Double.parseDouble(tf1.getString()); double c; public d1(midlet md) { super("phép tính"); append(tf); append(tf1); addCommand(back); addCommand(cong); setCommandListener(md); } public void phepcong() { c = a + b; append("kết quả là " + c); } public void commandAction(Command cm, Displayable dp) { } }