java extract words from string code example
Example 1: how to get individual words from a string in java
{
public static void main(String args[])
{
String str = "Hey this is Ram";
String [] words = str. split(" ", 3);
for (String word : words)
System. out. println(word);
Example 2: java string extract words
String test = "My first arg test";
String[] words = test.split(" ");
for (String word : words) System.out.println(word);