Here you can find the source of getNextWord(Scanner scan)
public static String getNextWord(Scanner scan)
//package com.java2s; //License from project: Apache License import java.util.Scanner; public class Main { public static String getNextWord(Scanner scan) { String word = scan.nextLine(); return word.trim(); }//w ww . ja v a 2s .c om }