Play audio slide show -- Keyboard shortcut: 'x'  Back to slide -- Keyboard shortcut: 'u'  next  next  Play sound for this slide -- Keyboard shortcut: 'y'  IoDemo4.java - Eksempler på anvendelse af input kommandoer fra klassen SimpleInput.Lecture 3 - slide 35 : 39
Program 3

// 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 + ". ");

  }

}