r/javahelp • • Jul 19 '17

Alphanumeric password input

I'd like to have an idea on how to make this program please.

It asks for an input password that meets these conditions:

-at least 6 characters long

-contains 1 capital letter or more

-alphanumeric

It denies the input if it doesn't meet those conditions, no need to hide it in asterisks.

I'm kinda new to Java and any kind of help will be appreciated

0 Upvotes

5 comments sorted by

•

u/desrtfx Out of Coffee error - System halted Jul 19 '17

What have you tried?

So far, your post shows zero effort from your side. This is a strict no-go in this subreddit. You need to at least try something.

1

u/BreastChaser Jul 19 '17

my only problem is how to measure the string length now

1

u/BreastChaser Jul 19 '17

oh wait done now

2

u/desrtfx Out of Coffee error - System halted Jul 19 '17

How about looking at the Oracle Documentation of the String class?

Always start by looking at the official documentation first.

1

u/heckler82 Intermediate Brewer Jul 19 '17 edited Jul 19 '17

Look at the String and Character classes. They have all the methods you will need to accomplish this task.

 

Get the input, then go character by character and determine if it is an uppercase letter or a digit and then at the end, ensure both conditions were met. Regular expressions would be an easier method, but you should get the basics down first.