Go Back   Java Programming Forums > Java Standard Edition Programming Help > File I/O & Other I/O Streams


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 13-06-2009, 08:28 PM
Junior Member
 

Join Date: Jun 2009
Posts: 21
Thanks: 1
Thanked 0 Times in 0 Posts
pwngrammer is on a distinguished road
Question java password

Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does.



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 15-06-2009, 02:37 AM
Fendaril's Avatar
Member
 

Join Date: Nov 2008
Posts: 54
Thanks: 7
Thanked 5 Times in 5 Posts
Fendaril is on a distinguished road
Default Re: java password

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 .
Reply With Quote
  #3 (permalink)  
Old 15-06-2009, 02:45 AM
Truffy's Avatar
Member
 

Join Date: May 2009
Location: Philippines
Posts: 92
Thanks: 2
Thanked 9 Times in 7 Posts
Truffy is on a distinguished road

I'm feeling Angelic
Default Re: java password

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
Reply With Quote
  #4 (permalink)  
Old 15-06-2009, 09:45 AM
JavaPF's Avatar
mmm.. coffee
 
8 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,543
Thanks: 98
Thanked 92 Times in 85 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Relaxed
Default Re: java password

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...
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
  #5 (permalink)  
Old 15-06-2009, 12:57 PM
JavaPF's Avatar
mmm.. coffee
 
8 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,543
Thanks: 98
Thanked 92 Times in 85 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Relaxed
Red face Re: java password

Quote:
Originally Posted by Fendaril View Post
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 .
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:

Java Code
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.");

    }
}
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
  #6 (permalink)  
Old 15-06-2009, 02:39 PM
Junior Member
 

Join Date: Jun 2009
Posts: 21
Thanks: 1
Thanked 0 Times in 0 Posts
pwngrammer is on a distinguished road
Default Re: java password

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
Reply With Quote
  #7 (permalink)  
Old 15-06-2009, 02:49 PM
JavaPF's Avatar
mmm.. coffee
 
8 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,543
Thanks: 98
Thanked 92 Times in 85 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Relaxed
Default Re: java password

Quote:
Originally Posted by pwngrammer View Post
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
There are no errors in that code. It was tested before posting. Did you include the imports? import java.io.*;
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Generator? Lizard What's Wrong With My Code? 3 16-05-2009 12:49 PM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jbutton java jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 01:47 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.