now when i enter username as "java" & password as "midp" it still shows me login failed.whats the problem?Code:import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; import javax.microedition.lcdui.*; public class first extends MIDlet implements CommandListener{ Display display; Form loginform = new Form("Login Apps"); private Command login_command = new Command("Login",Command.OK,1); private Command exit_command = new Command("Exit",Command.EXIT,2); TextField UserName = new TextField("Enter UserName","",10,TextField.NON_PREDICTIVE); TextField PassWord = new TextField("Enter Password","",10,TextField.NON_PREDICTIVE); StringItem Status = new StringItem("Status","Please Login to see Status"); public first() { } protected void destroyApp(boolean Exit_type) throws MIDletStateChangeException { } protected void pauseApp() { } protected void startApp() throws MIDletStateChangeException { loginform.append(UserName); loginform.append(PassWord); loginform.append(Status); loginform.addCommand(login_command); loginform.addCommand(exit_command); loginform.setCommandListener(this); display = Display.getDisplay(this); display.setCurrent(loginform); } public void commandAction(Command cmd, Displayable arg1) { if(cmd==login_command) { String login = UserName.getString(); String pass = PassWord.getString(); if(login=="java" && pass=="midp") Status.setText("Login Sucess!!!!"); else Status.setText("Login Failed!.Try Again!"); UserName.setString(""); PassWord.setString(""); } else if(cmd==exit_command) notifyDestroyed(); } }
Thanks for helping!

Reply With Quote


