Here you can find the source of termInput()
public static String termInput()
//package com.java2s; //License from project: Open Source License import java.util.Scanner; public class Main { public static String termInput() { Scanner in = new Scanner(System.in); String result = ""; boolean done = false; // Read query terms (String) from the keyboard while (!done) { result = in.nextLine();//www. j av a 2 s . c om if (result.length() < 3) { System.out .println("Please enter at least one keyword that's " + "at least 3 characters long:"); } else { done = true; } } return result; } }