Art, asked by rahulkumar9817514994, 7 months ago

cambly app m comments Kaisa kre ....I am new​

Answers

Answered by mdd19203
0

Answer:

import java.util.*;

public class Exercise60 {

public static void main(String[] args){

Scanner in = new Scanner(System.in);

System.out.print("Input a Sentence: ");

String line = in.nextLine();

String[] words = line.split("[ ]+");

System.out.println("Penultimate word: "+words[words.length - 2]);

}

}

Similar questions