Menu
Question Index
...

Create a word from the last letters of multiple words (2d char array). The words length might be different.

Input(2D char array) Output(char array)
{ {'P', 'e', 'a', 'c', 'h'}, {'A', 'p', 'p', 'l', 'e'}, {'P', 'a', 'p', 'a', 'y', 'a'}, {'C', 'o', 'c', 'o', 'n', 'u', 't'} } {'h', 'e', 'a', 't'}
{ { 'D', 'e', 'h', 'r', 'a', 'd', 'u', 'n' }, { 'J', 'a', 'i', 'p', 'u', 'r' }, { 'M', 'u', 'm', 'b', 'a', 'i'} } {'n', 'r', 'i'}
{ { 'H', 'e', 'l', 'l', 'o' }, { 'G', 'o', 'u', 't', 'a', 'm' } } {'o', 'm'}



class CreateWordFromLastLetters
{
    public static void main(String s[])
    {
        char multipleWords[][] = {    {'P', 'e', 'a', 'c', 'h'},
                        {'A', 'p', 'p', 'l', 'e'},
                        {'P', 'a', 'p', 'a', 'y', 'a'},
                        {'C', 'o', 'c', 'o', 'n', 'u', 't'}
                    };
        char word[] = createWord(multipleWords);
        System.out.print("The word is  ");
        for(char ch : word)
        System.out.print(ch + "");

    }


    public static char[] createWord(char [][]words)
    {
    }

}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App