Menu
Question Index
...

Write a program to get the last matched string having the given keyword from the list of words. The search should not be case sensitive.

Input (List, String) Output (String)
[RHOB, NPHI, DT, GR, RHO8], NPHI NPHI
[roja, saroja, neeraja, Rajesh, Raja, Ramana], Roj saroja
[kaLPAna, pandey, pandari, anand], aNd anand
[kaLPAna, pandey, pandari, anand], kal kaLPAna
[kaLPAna, pandey, pandari, anand], RHO null


import java.util.List;
import java.util.ArrayList;
class GetLastMatchHavingKeyword
{
    public static void main(String s[])
    {
        ArrayList<String> strings = new ArrayList<String>();
        strings.add("RHOB");
        strings.add("NPHI");
        strings.add("DT");
        strings.add("GR");
        strings.add("RHO8");
        System.out.println("The last match having the keyword RHO is : " + getLastMatch(strings, "RHO"));

    }


    public static String getLastMatch(List<String> strings, String keyword) {
    }

}


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