Write a java program
Attachments:
Answers
Answered by
0
Answer:
a java program to split words in to diffrent lines.
Explanation:
import java.util.Scanner;
class Class_10
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter a sentence");
String s1= input.nextLine();
for(String word : s1.split(" "))
{
System.out.println(word);
}
}
}
Similar questions