Cheers Koti - would it not be
s.close();
in that instance?
Type: Posts; User: Scren
Cheers Koti - would it not be
s.close();
in that instance?
Ah makes sense and I instantly feel a bit silly, cheers greg.
But looking at the code in my first post - I've created a new scanner for each one, name1, name2, age.....
Is there a better way that I should have done this?
cheers
Ah right - so all the lines that I've written that create new scanners are wrong... And I should just write
Scanner age = (System.in)
?
Hello, very new... I've just been playing around with a program that's meant to ask the user for their name and age...
Here's the code :
import java.util.Scanner;
public class Noerng {