JAVA IF Else variables -
public void actionperformed(actionevent arg0) { string employeeinput; string assetinput; string userinput = txtuserinput.gettext(); userinput = userinput.tolowercase(); if (userinput.startswith("emp")){ //string employeeinput = null; employeeinput = userinput.replaceall("\\s",""); txtuserinput.settext(""); joptionpane.showmessagedialog(frame, "the scan " ); }else if (userinput.startswith("u")){ assetinput = userinput; assetinput.replaceall("\\s",""); txtuserinput.settext(""); system.out.println("employee id " + **employeeinput**); //asks employeeinput declared. joptionpane.showmessagedialog(frame, "the scan " + assetinput);
i want employeeinput filled , saved, untill replaced employeeinput. problem i'm having when getting item input, employeeinput missing. way this?
thank you,
employeeinput
method variable, everytime exit method lose reference it.
the obvious thing try turn employeeinput
member variable. declare @ top of class.
better yet may persist value database.
Comments
Post a Comment