Computer Science, asked by mansiagrawal56, 3 months ago

Write a java program ​

Attachments:

Answers

Answered by kevinpcrispin
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