sandhya arora
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
0 Answer(s)      5 years and 7 months ago
Posted in : MobileApplications

import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class add1 extends MIDlet implements CommandListener { private Form f; private Display disp; private Command result,ok; private TextField t1,t2; public add1() { f=new Form("Addtion of two numbers"); // result=new Command("Result",Command.OK,1); ok=new Command("Ok",Command.OK,1); t1=new TextField("enter the first number",null,50,TextField.NUMERIC); t2=new TextField("enter the second number",null,50,TextField.NUMERIC); f.append(t1); f.append(t2); // f.addCommand(result); f.addCommand(ok); disp.getDisplay(this).setCurrent(f);

public void startApp() {

public void pauseApp() {

public void destroyApp(boolean unconditional) {

public void commandAction(Command command, Displayable displayable) {
        Form f2=new Form("displaying result");
        String n=t1.getString();
        String cd=t2.getString();
        int n1=Integer.parseInt(n);
        int n2=Integer.parseInt(cd);
        int result=n1+n2;
        Command c3=new Command("back",Command.BACK,1);




View Answers