Ik ben op zoek naar een Java commando/methode/wat dan ook dat gelijkwaardig is aan de getChar() command van C. Dus iets dat wacht tot het toetsenbord 1 teken geeft, dan geen enter behoeft en dat teken meteen in een string opslaat. Wie weet/heeft er zoiets?
Zoiets?Java:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.io.IOException; public class MainClass { public static void main(String[] args) { int inChar; System.out.println("Enter a Character:"); try { inChar = System.in.read(); System.out.print("You entered "); System.out.println(inChar); } catch (IOException e){ System.out.println("Error reading from user"); } } }
https://oneerlijkewoz.nl
Op papier is hij aan het tekenen, maar in de praktijk...
Volgende keer zelf even Googlen, we zijn hier geen Google-service.
[google=java getchar equivalent]
[google=java command line character input]
[google=java getchar equivalent]
[google=java command line character input]
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.
Dit topic is gesloten.