Menu
Question Index
...

Write a program to get reverse of elements in the array.

Input String Array Output String List
{Sachin Tendulkar, Sehwag, Yuvraj Singh, Dhoni, Gautam Gambhir, Suresh Raina, Rohit Sharma, Virat Kohli} [Virat Kohli, Rohit Sharma, Suresh Raina, Gautam Gambhir, Dhoni, Yuvraj Singh, Sehwag, Sachin Tendulkar]
{Maths, Physics, Chemistry, English, Telugu} [Telugu, English, Chemistry, Physics, Maths]
{} - EMPTY ARRAY null
null - NULL ARRAY null


import java.util.*;
class ReverseTheElementsOfList
{
    public static void main(String s[])
    {
        String[] cricketPlayers = {"Sachin Tendulkar", "Sehwag", "Yuvraj Singh", "Dhoni", "Gautam Gambhir", "Suresh Raina", "Rohit Sharma", "Virat Kohli"};
        List<String> result = getReverseOfElements(cricketPlayers);
        System.out.println("The output of the program");
        for(String inputString : result)
        {
            System.out.println(inputString);    
        }

    }


    public static List<String> getReverseOfElements(String[] inputArray)
    {
        List<String> 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