I am trying to string input for UVA online judge problem using JAVA.
like C++
while(s = getchar()) {
if(s == EOF)
}
import java.util.Scanner;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a string.");
String str = scanner.nextLine();
Is this what you're looking for? If you're reading from a file,
import java.io.File;
Scanner scanner = new Scanner(new File("path.txt"));
while (scanner.hasNextLine()) {
String str = scanner.nextLine();
//...
}