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 8900221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:03:20+00:00 2026-06-15T01:03:20+00:00

This CSV reader which also checks the validity of an email address and password

  • 0

This CSV reader which also checks the validity of an email address and password through the use of the map tool.

import java.io.*;
import java.util.*;

public class CSVReaders{

public static void  run(String[] args) throws Exception {
    Map<String, String> emailPasswordMap = new HashMap<String, String> ();
    BufferedReader CSVFile =
        new BufferedReader(new FileReader("testa453.csv"));
    String dataRow = CSVFile.readLine();
    while (dataRow != null){
        String[] dataArray = dataRow.split(",");
        emailPasswordMap.put (dataArray[0], dataArray[1]);
        dataRow = CSVFile.readLine();
    }
    CSVFile.close();
    //Scanner in = new Scanner(System.in);
    //String email = in.nextLine();
    //String password = in.nextLine();
    String password = ("raj45");
    String email = ("rakhter@bluebell.org");
    if (password.equals (emailPasswordMap.get (email))) {
        System.out.println ("The entered email and password are valid");
    }
    else {
        System.out.println ("The entered email and password are invalid");
    }

}

}

The problem which I am getting is that upon runing when i change the ‘//’ over to the string password and email and attempt to use the scanner which I have included the program ‘runs’ but console window does not appear and I have to force stop the program to stop it running. Whilst using it as I have shown here it works perfectly. Previously I had an error with the scanner that related to static and non-static variables. I have looked them up and attempted to use instance variables but to little success.
Is the way in which I have declared the scanner wrong or can I not use Mapping in conjuction with the scanner?

EDIT: I am currently using BlueJ on Mac since I am reasonably new to java programming. And yes it does work as I have quoted it, it only stops working when I try to use the scanner.

  • 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-15T01:03:21+00:00Added an answer on June 15, 2026 at 1:03 am

    Is the way in which I have declared the scanner wrong or can I not use Mapping in conjuction with the scanner?

    The Scanner declaration appears to be correct. No, there is no restriction prohibiting the simultaneous use of any two parts of the Java standard library. So it is perfectly okay to use Map and Scanner together.

    At current, the SO community’s best guess is that you are using an IDE (like eclipse) that has a built-in console window/view. Under this assumption, it is assumed that you expect a black terminal/cmd window to open, however in most IDEs this is not the case. In eclipse the “console view” is where you will do your input. In Netbeans this will be the output window.

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

Sidebar

Related Questions

This is the code i use to create a graph which searches for .csv
I want all CSV files in a directory, so I use glob('my/dir/*.CSV') This however
A while back I wrote a silverlight user control which had a csv import/export
This is a part of a large csv file which I have: 66.35.223.128,66.35.223.143,1109647232,1109647247,AU,Australia 66.35.223.144,66.35.227.191,1109647248,1109648319,US,United
I have copied this script from python web site : import sqlite3 import csv
Is there a way to Import an entire CSV file into SQLite through the
Ok so I am trying to import a csv which I need to insert
I am trying to read this .csv file and here is an example of
Okay, so I have this CSV file of products and all the products have
I want to turn this (Mitarbeiter.csv): Max;Mustermann;02.03.1964;501;GL;Prokurist Monika;Mueller;02.02.1972;500;Sek;Chefsekretaerin Michael;Maier;06.07.1985;617;Aquise;- into this (header-content.html): <tr><td>Max</td><td>Mustermann</td><td>501</td></tr> <tr><td>Monika</td><td>Mueller</td><td>500</td></tr>

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.