This is a simple program in which user enter a string and program split its words on the bases of spaces. An array of string is use to store these words and display them one by one.
Source Code
package com.ancodingpoint.ww.w; import java.util.Scanner; public class String_Function { public static void main(String[] args) { Scanner input = new Scanner (System.in); String a = ""; System.out.println(" Enter Your Story Here !..... "); a = input.nextLine(); String [] words = a.split(" "); for (String word : words) { System.out.println(word); } } }
0 comments:
Post a Comment