Menu
Question Index
...

Write a program to find given value is exist in array or not.

Input(String Array, Searched String) Output
{Raviteja, Venkatesh, Chiranjeevi, Mahesh babu, Prabhas}
Nani
false
{MEC, EEE, CIVIL, ECE, CSE, IT}
CSE
true
{Apple, Orange, Grapes, Peach, Banana, Mango}
Pineapple
false
{} - EMPTY ARRAY
ECE
false
{MEC, EEE, CIVIL, ECE, CSE, IT}
null
false
null - NULL ARRAY
null
false



class CheckGivenItemIsExist
{
    public static void main(String s[])
    {
        String[] batsman = {"Sachin Tendulkar", "Sehwag", "Yuvraj Singh", "Dhoni", "Gautam Gambhir", "Suresh Raina", "Rohit Sharma", "Virat Kohli"};
        String newBatsman = "Unmukt Chand";
        boolean isExist = isGivenItemExist(batsman, newBatsman);
        System.out.println("The output should be "+isExist);

    }


        public static boolean isGivenItemExist(String[] inputArray, String searchItem)
        {
            boolean result = false;
            return result;
        }

}

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