// import oopcourse.util.SimpleInput;
// Kræver pt. at SimpleInput.class findes i samme katalog som IoDemo4.class
class IoDemo4 {
public static void main(String[] args){
System.out.println("SimpleInput Demo");
SimpleInput keyboard = new SimpleInput();
int i; double d ; String s;
System.out.print("Indlæs et heltal: ");
i = keyboard.nextInt();
System.out.print("Indlæs et reelt tal: ");
d = keyboard.nextDouble();
System.out.print("Indlæs en tekststreng: ");
s = keyboard.nextLine();
System.out.print("i = " + i + ". ");
System.out.print("d = " + d + ". ");
System.out.print("s = " + s + ". ");
}
}
|