java - Butchering a String word wise -


I am trying to isolate a long string in each word and try to print it sequentially in java I am doing this, but this exception throws . Any input is highly appreciated:

  public class spell checker {public static zero test (string str) {int i = 0, j = 0, n = str.length (); String floating = ""; Do {for (i = j; str.charAt (i)! = ''; I ++) temp + = str.charAt (i); Floating + = '\ 0'; Println (temporary); Temporary = ""; j = i + 1; } While (J & lt; n); } Public static zero main (string [] args) {java.util.Scanner input = new java.util.Scanner (System.in); System.out.print ("Enter the string for which you want to check spelling:"); String = string = input.next (); Test (strng); }}    

You use next () instead

Code> string in strng = input.nextLine ();

Your next test should be on the test () method

  public static zero test (string str) {string [] Word = str.split ("\\ s +"); For (string word: word) {System.out.println (word); // decide what you want to do with each word}}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -