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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:09:50+00:00 2026-06-01T04:09:50+00:00

As part of the program that I am writing I need it to: Compare

  • 0

As part of the program that I am writing I need it to:

  1. Compare two strings from two different files
  2. Return only the true values, that is the strings that match in the files.
  3. Return the number of true values and what lines in the file they are located on.

The code that I have for the comparison at the moment is:

    boolean result = mainEmail.trim().contentEquals(deletionemailAddress.trim());
    System.out.println(mainEmail);
    System.out.println(deletionemailAddress);
    System.out.println(result);

It uses both trim() and contentEquals() to make sure that the two strings are the same. It then prints out a list of the strings and states whether they are the same or not. What I would like to do is to have none of the false results printed only the true statements (The mainEmail, deletionemailAddress, and result variables) to be printed. I want to count the number of true statements only and return the number of true statements as well as what lines in the mainEmail file they are located on.

What would be the most effective way in order to display only the true statements(matching emails too) and a count saying how many true statements that they are?

  • 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-01T04:09:51+00:00Added an answer on June 1, 2026 at 4:09 am

    Have you heard about if?

    boolean result = mainEmail.trim().contentEquals(deletionemailAddress.trim());
    int count = 0;
    if (result){
        count++;
        System.out.println(mainEmail);
        System.out.println(deletionemailAddress);
        System.out.println(result);
    }
    System.out.println(count);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in the process of writing an assembly program that takes two strings as
I'm writing a program that for one part asks for the program to print
I am writing a GLSL program as part of a plugin that runs inside
I'm currently writing a program that needs to compare each file in an ArrayList
So I am currently writing a part of a program that takes user text
I'm writing this program that will need to access the registry to pull some
As part of a program I'm writing, I need to solve a cubic equation
I wrote part of a program that does some heavy work with strings in
I'm writing a program that implements the RFC 2544 network test. As the part
I'm writing a program that gathers user input for two file names, and opens

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.