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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -