Topics Index

Create A Word From The Last Letters Of Multiple Words

If you need explanation Read this topic

If you need Answer Take test on this topic

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)

Topic: Learn Arrays And Loops

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

here we have to make word from last letter of a 2D charachtrr array....... a 2D array stores values in rows amd column format .......we have to extract the last letter of every row to make a word..... so here we have to store output in array.the size of the output array is the total row in the input 2 d array ... now we have a 2 d has r row and c column... .. we have to use  loop........ take variable a=0 to r-1... this loop is for traversing every row.... now output[a]= input[a][c-1] ......this will str last charactr of each row into output.... exit loop return output

Posted by Asma Mujtaba Khan    2015-01-02 10:34:19

create an output array with size of words array...length of 2-d array means num of rows in that we have to copy the last char into array so take and loop fro travelling through the array..last char means length of the each row-1..

Posted by Uday Kumar    2015-01-02 12:18:55

This dose is now closed and the winners are Asma Mujtaba Khan,  for 'First Correct Comment', Uday Kumar,  for 'Second Correct Comment'. The 'lucky liker' is Uday Kumar. Please login into Merit Campus using facebook, to claim your recharge. Go to to raise the recharge.

Posted by Merit Campus    2015-01-06 05:54:25

© meritcampus 2019

All Rights Reserved.

Open In App