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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:33:11+00:00 2026-05-29T05:33:11+00:00

I cannot see what I am doing wrong here. Here is the code I

  • 0

I cannot see what I am doing wrong here. Here is the code I am having trouble with :

String tempSummaryString = "SUMMARY:";
for(int z = 0; z<attributeList.size() ; z++)
{
    System.out.println(attributeList.get(z).substring(0,tempSummaryString.length()));
    if(attributeList.get(z).length() > tempSummaryString.length() && 
       attributeList.get(z).substring(0,tempSummaryString.length() == tempSummaryString)
    {
            event.setTitle(attributeList.get(z).substring(tempSummaryString.length(),attributeList.get(z).length()));
    }
}

Now my problem is that the program never goes into the if (does not execute the event.setTitle method). When I print the value of

attributeList.get(z).substring(0,tempSummaryString.length()) 

I get the following:

SUMMARY:

So I am stumped about why it is not entering the if! I don’t get it!

Hopefully someone can point out a stupid mistake I am making because I really dont know what else to do

  • 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-05-29T05:33:12+00:00Added an answer on May 29, 2026 at 5:33 am

    You’ve fallen for the old == vs equals() problem. You are using ==, which unlike javascript, does an identity comparison (ie are these the same objects).

    Try this:

    attributeList.get(z).substring(0,tempSummaryString.length())
        .equals(tempSummaryString) // equals() not ==
    

    Also, you should consider using the foreach syntax for your loop:

    for (String attribute : attributeList) {
        if (attribute.substring... // forget about attributeList.get(z) and even z
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot see what I am doing wrong here. Simply put, I want to
I have a couple of questions. 1) Why cannot we see system tables (like
for some reason I cannot see any of the generated objects under the TL
I see that tax information is kept at order level but I cannot see
I know that a 32-bit OS cannot see more than 4 GB of RAM.
We're testing WYSIWYG editors, and we cannot see to make them work with asynchronous
This is really weird, and I cannot see why this is happening. In the
For my Java apps with very long classpaths, I cannot see the main class
Why is the integrated vs debugger so... barely functional? I cannot see the contents
From the Microsoft website (see msdn.microsoft.com/en-us/library/ms683502(VS.85).aspx ) it clearly says Services cannot directly interact

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.