class WhileDemo {
public static void main(String[] args){
int count = 1;
while (count < 11) {
System.out.println("Count is: " + count);
count++;
}
}
}
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
// Create a file object, that can operate on MyTextFile.txt
// Does not create a file!
File file = new File("MyTextFile.txt");
// Create a file if and only if it does not exist
file.createNewFile();
public static void main(String[] args) throws Exception
{
Scanner sc = new Scanner(new File("MyTextFile.txt"));
while (sc.hasNextLong()) {
long aLong = sc.nextLong();
}
}
hasNext()
hasNextLine()
hasNextInt()
hasNextDouble()
``