Programmeren in Java/In- & uitvoer: verschil tussen versies

Verwijderde inhoud Toegevoegde inhoud
Modified the code to make it work
Regel 20:
\<source lang=java>
import java.util.Scanner;
import java.io.*; // Om 'Console' en 'System'
// te kunnen gebruiken
 
public class Invoer {
public static void main(String[] args) {throws Exception // 'main' wordt altijd uitgevoerd{
int getal;
int getal; // geheel getal
System.out.println("Typ een getal"); // uitvoer via het beeldscherm
Scanner sc = new Scanner(System.in);
getal = Console.in.readInt(); // invoer via het toetsenbord
getal = sc.nextInt();
System.out.println("Het ingevoerde getal is: " + getal); // uitvoer
}
}</source>
}}
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.