Java Jump möglichkeiten?
Hallo,
ich habe in Java folgende Aufgabe: Wir sollen einen Random Number Generator machen, dieser soll anhand User Eingaben in der Konsole dort eine Random Number ausgeben oder das Programm beenden, mit y wird eine weitere Zahl ausgegeben, bei jeder anderen Eingabe wird das Programm beendet.
Die Anforderung ist allerdings folgendes:
The first version should be purely imperative with a minimal set of required statements, namely an if with a single branch only, and the programming language feature X (something you have to find out). Using any other branching statement, looping statement, or method (with the exception of method main()), or recursion is strictly prohibited.
Wie soll man bitte eine unendliche Eingabe ohne irgendwelche funktionen, außer main, nur einem if statement, keine loops, keine rekursion schaffen? Gibt es Code Sprünge in Java? Außer Loop, methods usw wüsste ich da nicht?
Liebe Grüße
Just to your last question: goto is a keyword, but does nothing.
With break you can only jump out of blocks, but not repeat them. continues only within loops. return leaves the function. That’s all I remember.
I don’t know how to do that, but the solution would interest me…
The dissolution is probably not possible, our Prof has made a task pure that is not detachable… Had worked on it for so long and looked at everything… well you learn to do it or not…
But thanks for your answer:) !