Returning an Array results within a method

**Problem solved.** I have two methods in my class. private void retrieveDetails(){ List details = File.getCredentials(); username = details.get(0); pw = details.get(1); } private void checkCredentials() throws IOException { retrieveDetails(); System.out.println("\nPlease enter USERNAME: "); String usersName =; System.out.println("\nPlease enter PASSWORD: "); String usersPW =; System.out.println("\nEntered details: " + usersName + ", " + usersPW); System.out.println("\nSystems details: " + userName + ", " + pw); if (usersName.equals(username) && usersPW.equals(pw)) { doWork(); } else { System.out.println("Incorrect credentials"); } } I thought I came up with a solution by moving the following up to where my strings are initialized. List creds = File.getCredentials(); I created a `System.out` statement to check if the details coming from `retrieveDetails()` match those entered by the users. They do match - but when the system goes to the else clause instead of executing `doWork();`
What is plainPassword and pw? Are they same or different?

以上就是Returning an Array results within a method的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准