Hi all,
I’m a newbie in Java.
When I need input something from keyboard, Sublime Text 2 seems not supporting to do that.
For example:
import java.util.*;
class Scan{
public static void main(String] args) {
Scanner ca = new Scanner(System.in);
System.out.print("Input your name: ");
String ten = ca.nextLine();
System.out.println(ten);
}
}
I got the following error:
Input your name: Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1540)
at Scan.main(Scan.java:6)
[Finished in 1.3s with exit code 1]
I found out that No console input causes this problem.
How can I overcome this problem?
I searched and found this topic on Stackoverflow http://stackoverflow.com/questions/15289352/java-console-input-in-sublime-text-2 , but it’s useful for Windows’s users. I’m using MAC OS !!!
Any one has an idea for MAC OS??
Thank you for reading !!!