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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:07:25+00:00 2026-06-14T02:07:25+00:00

I want a core java program to find unique elements between two arrays. Example:

  • 0

I want a core java program to find unique elements between two arrays.
Example:
Array1 – 9, 5,3,23,2,5
Array2 – 19, 5,3,23,24,53

output of unique elements from both of the array’s should print as: 9, 2, 19, 24, 53

pls help me to write the program with accurate loops.

NOTE: Dont want to handle the same program using any of the collections and want to be done using only loops. 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-14T02:07:27+00:00Added an answer on June 14, 2026 at 2:07 am

    You have to use at least 2 loops.

    public void uniqueM(int arrayA[], int arrayB[]){
        boolean uniqueA = true, uniqueB = true;
        int high_size = arrayA.length, low_size = arrayB.length;
    
       if(arrayA.length < arrayB.length){
         low_size = arrayA.length;
         high_size = arrayB.length;
        }
    
        for(int i = 0; i < high_size; i++){
          for(int j = 0; j < low_size;j++)
          {
             if(i < arrayA.length && arrayA[i] == arrayB[j]) uniqueA = false;
             if(i < arrayB.length && arrayB[i] == arrayA[j]) uniqueB = false;
          }
           if(uniqueA && i < arrayA.length) System.out.println(arrayA[i]);
           if(uniqueB && i < arrayB.length) System.out.println(arrayB[i]);
    
           uniqueA = true;
           uniqueB = true;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently learned core Java and want to develop my skills further with practice
I have program in Java that I want to rewrite (GUI and some new
I can't compile my Program.java from the command line (only in Eclipse). When I
I am still a learner of core java. I want to understand the polymorphism
If I want to make my Java program to be able accept plugins, how
Using Eclipse I want to view the source code for a core Java class
I want to use JSR 172 API in android . But supports core java
I want to use JSTL I tried to import taglib using: <%@ taglib uri=http://java.sun.com/jsp/jstl/core
I know core Java and have worked a little with J2EE. But I want
I have an external JAR signpost-core-1.2.1.1.jar (from http://code.google.com/p/oauth-signpost/ ), that I want to include

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.