Menu
Question Index
...

Write a program to get the common friends between two friends arrays.

Input (String Array1, String Array2) Output (String commonNames Array)
{Roopa, Reena, Raj, Lucky}, {Raj, Swapna, Geetha, Roopa} {Roopa, Raj}
{Madhuri, Vinay, Vijay, Nilesh, Radhika}, {Nilesh, Vijay, Radha, Rama, Madhuri} {Madhuri, Vijay, Nilesh}
{Krish, Meena, Jyothi, Sowjanya}, {Jyothi, Pavani, Pavan} {Jyothi}
{}, {Siva, Mahesh, Narayana, Kiran, Srinath} {}



class CommonFriends
{
    public static void main(String s[])
    {
        String friends1[] = {"Kiranmai", "Pooja", "Navya", "Anu", "Divya", "Hema"};
        String friends2[] = {"Kiranmai", "Navya", "Roopa", "Divya", "Ramya", "Roja"};
        String result[] = getCommonFriends(friends1, friends2);
        System.out.print("Common friends are: ");
        for(int i = 0; i < result.length; i++)
        {
        System.out.print(result[i] + " ");
        }

    }


        public static String[] getCommonFriends(String friends1[], String friends2[])
        {
        }

}

Doubts

Problems

Topic: Java String Arrays - String Arrays In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App