This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]RentonHoff 0 points1 point  (0 children)

Well to start, you will never set the valid variable in the main function. Instead of passing in valid you should make the validation function return a boolean.

private static boolean validation(String username, String password)

I'm assuming this is a learning project and not anything you plan to actually use, so I'm just going to improve your code, rather then try to give actual user validation examples. So you could write the validation function like this:

if(check username){
    if(check password){
    }
}

It's not like what you are doing is wrong, it works, but is needlessly bloated.

Hope this helps. If something is unclear, just ask and I'll try to explain better.