![]() |
| ||
| Basic Password Verifier Hey there, this is my first post here and I'm in the need of some real help. I've written a basic password verifier, which checks to see if what you type in is the same as the default stored password, but i continually get a compile error. import java.util.Scanner; And then here is my driver class import java.util.Scanner; The error i get when I'm compiling is PasswordVerifier.java:30: charAt(int) in java.lang.String cannot be applied to (boolean) if (!Character(userPass.charAt(index == 'c'))) ^ PasswordVerifier.java:33: charAt(int) in java.lang.String cannot be applied to (boolean) if (!Character(userPass.charAt(index == 'o'))) ^ PasswordVerifier.java:36: charAt(int) in java.lang.String cannot be applied to (boolean) if (!Character(userPass.charAt(index == 'o'))) ^ PasswordVerifier.java:39: charAt(int) in java.lang.String cannot be applied to (boolean) if (!Character(userPass.charAt(index == 'l'))) could someone please help me out, i've tried multiple variances and fixes, but alas... none work for me. Thanks everyone! |
| ||
| Re: Basic Password Verifier it needs to be changed to this format if (userPass.charAt(index) == 'c') but you are making it hard, you can do this if(userPass.startsWith("cool")){ |
| ||
| Re: Basic Password Verifier startsWith? so "coolblahblahblah" will be true too? not sure that sounds totally secure, but yeah, the compiler error is as stated above. |
| ||
| Re: Basic Password Verifier I think you have misplaced the parenthesis: This: if (!Character(userPass.charAt(index == 'c'))) Should be: if (!Character(userPass.charAt(index) == 'c')) You could also try: goodSoFar = userPass.equals("cool"); |
| ||
| Re: Basic Password Verifier lol i don't think checking if the password contains c o o l, was too secure, thats why i made the post |
| ||
| Re: Basic Password Verifier thanks dickersonka... that fixed the compile issue for the constructor, but in the drive i'm now getting the following error, yet i see nothing wrong =\ symbol : method PW(java.lang.String) location: class PasswordDriver if (PW(user)) |
| ||
| Re: Basic Password Verifier You already have the "PasswordVerifier" so you now want to use the methods within it. PW.isValid(user) |
| ||
| Re: Basic Password Verifier wow ... and to think I thought the .equals(..) method worked great :) |
| All times are GMT -4. The time now is 6:24 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC