Menu
Question Index
...

Write a program to get string item after given string from list.

Input (String List, Input String) Output (String)
[One, Two, Three, Four, Five, Six, Seven]
Five
Six
[byte, short, int, long, float, double]
char
null
[Apple, Banana, Grapes, Orange, Mango]
null
null
{} EMPTY ARRAY
Six
null
null - NULL ARRAY
null
null


import java.util.*;
class GetStringItemAfterTheGivenStringItemFromList
{
    public static void main(String s[])
    {
        ArrayList<String> list = new ArrayList<String>();
        list.add("One");
        list.add("Two");
        list.add("Three");
        list.add("Four");
        list.add("Five");
        list.add("Six");
        list.add("Seven");
        String inputString = "Five";
        String result = getStringAfter(list, inputString);
        System.out.println("The string after Five is " + result);

    }


    public static String getStringAfter(List<String> list, String inputString)
    {
        String result = null;
        return result;
    }
    public static Boolean isValidIndex(List<String> list, int index)
    {
        Boolean result = null;
        return result;
    }

}

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App