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

The Archive Base Latest Questions

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

private void refineWords() { for(String word : words){ Log.i(word, word); if (word == s

  • 0
private void refineWords() {
    for(String word : words){
        Log.i("word", word);
        if (word == "s" || word == "t" || word == "am" || word == "is" || word == "are" || word == "was" || word == "were" || word == "has" || 
            word == "have" || word == "been" || word == "will" || word == "be" || word == "would" || word == "should" || word == "shall" || 
            word == "must" || word == "can" || word == "could" || word == "the" || word == "as" || word == "it" || word == "they" ||
            word == "their" || word == "he" || word == "she" || word == "his" || word == "her" || word == "him" || word == "its" ||
            word == "in" || word == "on" || word == "a" || word == "at") {

            Log.i("step", "step Success!!");
            words.remove(word);
        }
    }
}

I have a List called “words” and it contains strings. Here the Log.i works for the “word” tag fine but the “step” Statement does not executes. Seems the If condition does not work well. like this method never goes into it although the “words” list contains similar strings. What would be the problem. pleas 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-01T03:55:10+00:00Added an answer on June 1, 2026 at 3:55 am

    You need to use String.equals(), not ==. == checks if two Object references refer to the same Object:

    if("s".equals(word) || "t".equals(word) || ...
    

    From section 15.21.3 Reference Equality Operators == and != of the Java Language Specification 3.0:

    While == may be used to compare references of type String, such an equality
    test determines whether or not the two operands refer to the same String
    object. The result is false if the operands are distinct String objects, even if
    they contain the same sequence of characters. The contents of two strings s and t
    can be tested for equality by the method invocation s.equals(t).

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

Sidebar

Related Questions

I have this code private void writeReport(IReport report, string reportName) { string reportString =
private void StringAction(string aString) // method to be called { return; } private void
private void save(Rectangle src, Rectangle dest, string fName, int width, int height, Bitmap file)
private void Test(string param) { Thread.Sleep(OneDay); Submit(param); } This is console application. Is there
private void InsertLinks(IEnumerable<string> urls) { EntityDataModelContext context = DataContext.GetDataContext(); foreach (string url in urls)
private void button1_Click(object sender, EventArgs e) { string name; name = textBox5.Text; SqlConnection con10
private void HeroMouseEnter(object sender, MouseEventArgs e) { ((Image)sender).Source = GetGlowingImage(((Image)sender).Name); } public ImageSource GetGlowingImage(string
private void playSound(){ Log.d(TAG,Play SOund); new Thread(new Runnable() { public void run() { MediaPlayer
private void button6_Click(object sender, EventArgs e) { string[] filePaths = Directory.GetFiles(@c:\MyDir\); } And I
private void Form1_Load(object sender, EventArgs e) { GetDataTable(@C:\Documents and Settings\agordon\Desktop\ACTIVITYEX.log); } public System.Data.DataTable GetDataTable(string

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.