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

  • Home
  • SEARCH
  • 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 9158597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:17:08+00:00 2026-06-17T13:17:08+00:00

Possible Duplicate: How do I compare strings in Java? yes the title sounds funny,

  • 0

Possible Duplicate:
How do I compare strings in Java?

yes the title sounds funny, I am working on this project for a special someone, and I want to ask her out by writing her a simple program. I am having some trouble though with the execution of this idea. I have a pseudo code ish plan in my mind but need help executing it. I was planning on having her input yes or no answers to questions in the console and have the program respond with answers based on her inputs. my Idea was her input yes or no answers to questions, and then say something like If input is “yes” then print this statement, else if “no” print this statement. I am currently having problems getting the if else part to work. I cant have strings act like booleans in an if statment, so I need some help with that. code I started with:

import java.io.*;
public class ask {
    public static void main(String [] args) throws IOException {
        BufferedReader in = new BufferedReader
                (new InputStreamReader(System.in));
        String answer;
        System.out.print("Would you like to go out with me? ");
        System.out.flush();
        answer = in.readLine();
        Boolean hope = Boolean.valueOf("yes");
        if (answer == hope) {
            System.out.print("Awesome!");
        }

        else
            System.out.print("Not awesome!");

    }
}

obviously Im not actually using that question those responses, im just putting it as in example just to get the program itself to work. I cannot compare answer to hope because one is boolean and the other is a string, I also cannot do string with string, so how do I get this to work. Any ideas?
Edit: Guys just to say, I know she will say yes, this is just a funny silly way to ask her out. I will be there IN PERSON with her while doing this, and I will tell her only to use yes or no so that way this works, its just a small simple project. Don’t need any advice or opinion on anything other than how to get this to work please! Thanks!

  • 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-17T13:17:09+00:00Added an answer on June 17, 2026 at 1:17 pm

    you can use string.equals() to compare string
    E.g. “Yes”.equals(answer) for comparison of yes and the variable answer

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

Sidebar

Related Questions

Possible Duplicate: How do I compare strings in Java? I have this code: System.out.println(staff.getEmail().length());
Possible Duplicate: How do I compare strings in Java? I'm sorry for this rather
Possible Duplicate: How do I compare strings in Java? I have written this code:
Possible Duplicate: How do I compare strings in Java? I have this code its
Possible Duplicate: How do I compare strings in Java? (This may be a duplicate,
Possible Duplicate: How do I compare strings in Java? Someone can tell me why
Possible Duplicate: How do I compare strings in Java? in my java app. To
Possible Duplicate: How do I compare strings in Java? I'm using String.valueOf to convert
Possible Duplicate: How do I compare strings in Java? java == vs equals() confusion
Possible Duplicate: How do I compare strings in Java? I have the following code

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.