Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7862389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:06:46+00:00 2026-06-02T23:06:46+00:00

I am wondering if there is a way to write text to a text

  • 0

I am wondering if there is a way to write text to a text file of the user typed in yes or no.
I am making a password generator and i was wondering if i could ask the user if they want to save the password or not, and if yes then it would save it to a text file for later use.

import java.util.Random;

public class pwdgencmd {
    public static void main(String args[]) {

        Random random = new Random();
        char l1 = (char)(random.nextInt(26) + 'A');
        int RI1 = new Random().nextInt(9) + 1;
        char l2 = (char)(random.nextInt(26) + 'A');
        char l5 = (char)(random.nextInt(26) + 'A');
        char l6 = (char)(random.nextInt(26) + 'A');
        char l7 = (char)(random.nextInt(26) + 'a');
        char l9 = (char)(random.nextInt(26) + 'a');
        int RI5 = new Random().nextInt(9) + 1;
        int RI6 = new Random().nextInt(9) + 1;
        int RI7 = new Random().nextInt(9) + 1;
        int RI8 = new Random().nextInt(9) + 1;
        int RI9 = new Random().nextInt(9) + 1;
        int RI10 = new Random().nextInt(9) + 1;
        char l3 = (char)(random.nextInt(26) + 'a');
        int RI3 = new Random().nextInt(9) + 1;
        char l4 = (char)(random.nextInt(26) + 'a');
        int RI4 = new Random().nextInt(9) + 1;
        double version = 1.1;
        String password1 = ("l1 + RI1 + l3 + RI5 + l5 + l7 + RI8 + RI6 + RI7 + l6 + l9 + l3");
        String password2 = ("l4 + l5 + RI6 + l3 + RI8 + RI5 + l6 + l4 + RI5 + RI9 + l7 + l1");
        String password3 = ("l3 + RI8 + RI10 + l4 + RI5 + l7 + l6 + l1 + RI7 + RI1 + l5 + l6 +");
        String Print1 = ("(1)Your password is " + password1 + ".");
        String Print2 = ("(2)Your password is " + password2 + ".");
        String Print3 = ("(3)Your password is " + password3 + ".");




        System.out.println("#Made by Jackson Harris");
        System.out.println("[Version]You are using version: " + version +  " Ranting Reindeer.");

        System.out.println(Print1);
        System.out.println(Print2);
        System.out.println(Print3);
      }
 }

What I am looking for is it to ask “Do you wish to save the password(s)? y/n” and if it is yes that it will save the passwords to saved_passwords.txt. Is it also possible to save a comment to it? e.g “Do you want to add a comment to this save? y/n” if yes then perhaps you would type “This is my password for …..” and it would save to the file as “This is my password for …..” with the password on the line below it.
Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:06:48+00:00Added an answer on June 2, 2026 at 11:06 pm

    Yes, it is possible. Use FileOutputStream/FileWriter to write to file. Check Oracle Link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if there is a way to write MIPS assembly language file (just
Is there a way to write python data structs to a file as text.
I'm wondering if there's a shorter way to write this: var x = 1;
I was wondering is there a way in PHP that you could tell where
Hi there i was wondering is there a way to write your code so
I'm wondering if there's a way to write-protect every page in a Linux process'
Just wondering if there is a better way to write this CSS? It repeats
I am wondering if theres a way to remotely write to a plist file
I am wondering if theres a way to remotely write to a plist file
I am wondering if there is an easy way to calculate the text extent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.