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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:16:10+00:00 2026-06-15T08:16:10+00:00

I am working on a java project and need to print common values between

  • 0

I am working on a java project and need to print common values between two arrays.

I have printed both arrays in their sorted order before hand and they both look good (containing all values they should). However, when I follow the simplest of algorithms (see below) I do not find all the common values even though I can manually see in the print out of the two arrays without comparison that there should be more values printed after executing the below:

        for(int i=0; i<fibList.size(); i++)
        {
            for(int j=0; j<primeList.size(); j++)
            {
                if(fibList.get(i) == primeList.get(j))
                {
                    System.out.print(" " + fibList.get(i));
                    break;
                }
            }
        }

Please let me know what you think. Hopefully this is just a simple error.

  • 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-15T08:16:11+00:00Added an answer on June 15, 2026 at 8:16 am

    Most likely you want to:

    Change:

    if(fibList.get(i) == primeList.get(j))
    

    To:

    if(fibList.get(i).equals(primeList.get(j)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Java project and need to have a keypress simulate
I am working on a java project and I need to pull some values
I'm working on a Java project where I need to have multiple tasks running
If I'm working on a cross-platform project that uses dbus-java, what do I need
I am working on a project where I need to have a buttonPanel in
I am currently working on a project where i need to have an in
I have binary ASN.1 data objects I need to parse into my Java project.
Im working on a java project where i need to read some objects from
I'm working on a java project in which i need to login to a
I am working on a java project. This project need admin privileges to execute

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.