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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:57:26+00:00 2026-06-14T21:57:26+00:00

I am currently been working on a program to parse CSV’s and then check

  • 0

I am currently been working on a program to parse CSV’s and then check an inputted email adress against the CSV and if it is valid display their personnel information. The problem I am coming across is the else statement to say that your email is invalid. My current code;

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

public class CSVReader123{

public static void main(String[] arg) throws Exception {

    BufferedReader CSVFile = new BufferedReader(new FileReader("testa453.csv"));
    String dataRow = CSVFile.readLine();
    //String email = "ojones@coldmail.net";
    //String password = "ocrabc";

    Scanner input = new Scanner(System.in);
    System.out.println("Please input an email adress");
    String email = input.nextLine();
    System.out.println("Please input you password");
    String password = input.nextLine();

    while (dataRow != null){

        String[] dataArray = dataRow.split(",");
        if ((dataArray[0].equals(email)) && (dataArray[1].equals(password))) {
            System.out.println("Your email is valid");
            System.out.println("Do you want to display you personel data?(Y or N)");
            String personeldata = input.nextLine();
            if ((personeldata.equals("yes")) || (personeldata.equals("Yes")) || (personeldata.equals("Y"))){
                System.out.println("You email is " +dataArray[0]+".");
                System.out.println("You password is " +dataArray[1]+".");
                System.out.println("You first name is " +dataArray[2]+".");
                System.out.println("You second name is " +dataArray[3]+".");
                System.out.println("You street name is " +dataArray[4]+".");
                System.out.println("You city name is " +dataArray[5]+".");
                System.out.println("You postcode is " +dataArray[6]+".");

            }
            else if ((personeldata.equals("no")) || (personeldata.equals("No")) || (personeldata.equals("N"))) {
                System.out.println("Shutting down.");
                break;
            }

        }
        else {
            System.out.println("BROKEN");
            break;
        }
        System.out.println();
        dataRow = CSVFile.readLine();
    }
    CSVFile.close();
    System.out.println();
}
}

The problem which I am having is that if I try to enter a valid or invalid email it will always print out broken and stop. Although if I remove said if statement the program runs perfectly and the rest of it works correctly. Have I somehow declared it in the incorrect place since the first else statement works perfectly? Any help would be appreciated.

  • 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-14T21:57:27+00:00Added an answer on June 14, 2026 at 9:57 pm

    You shouldn’t break from the loop. You must use continue, because there can be other rows which will pass the email check. I mean, because the first row does not pass the check, it doesn’t mean that the second row won’t pass it. You must check all rows.

    Make it like this:

    else {
         System.out.println("BROKEN");
         dataRow = CSVFile.readLine();
         continue;
    }
    

    Or just remove the whole else section like this:

    }
    
    //here was the else section
    
    System.out.println();
    dataRow = CSVFile.readLine();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on keeping things object oriented for my project. Currently, I'm
I am currently working with Python and have been confused over the fact that
I'm currently working on building a java web app. I've been looking to use
I'm working on a Java program, and it's been over a year since the
I'm currently working on a program (for fun, this is not an assignment) that
I have been working on a program that will enable me to monitor which
Currently I'm working on a small program that reads large files and sorts them.
I am currently working on a Javascript program for my company (Leader Technologies) that
I've been working with PHP quiz program and I'm a bit lost on fetching
I'm new to C# and have been working on learning database's. Currently I'm trying

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.