Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does.
Hello pwngrammer and welcome to the java programming forums. I think this belongs in the java program collaboration section located here: Project Collaboration - Java Programming Forums
I would help you out here but I don't know much about file I/O in java. Sorry .
welcome to the java programming forums.
it thinks this will help you. it can give you ramdon numbers, so it can be used for password.
http://www.javaprogrammingforums.com...m-numbers.html
bout writing in a file, hmm, try to search for it. kinda busy.
but i will try to keep in touch.
Cheers,
Truffy
Hello pwngrammer, welcome to the forums
Don't forget about our Tips & Tutorials forum. There are lots of code snippets in there:
Java Tips & Tutorials - Java Programming Forums
This is what you need for writing a file:
http://www.javaprogrammingforums.com...sing-java.html
I will write an example application for you ASAP...
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
That forum is more for projects that we work on as a team. pwngrammer is just being lazy and asking for someone to do the work for him
Try this pwngrammer:
import java.io.*; import java.util.Random; public class Pwngrammer { /** * JavaProgrammingForums.com */ public static void main(String[] args) throws Exception { Random r = new Random(); Writer output = null; File file = new File("PasswordFile.txt"); output = new BufferedWriter(new FileWriter(file)); int password = 0; for(int a = 0; a < 4; a++){ password = (int)(9.0 * Math.random()) + 1; System.out.print(password); String myString = Integer.toString(password); output.write(myString); } output.close(); System.out.println(""); System.out.println("Password written to file."); } }
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
Im doing this one for fun now. Thank you to all of you for helping me out with both my programs. This one has a problem. Cannot find symbol-class Writer
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.