+ 5
[Solved] Why loop always run two times if character is not 'q'
anyone can explain this code of java for(int i=0;(char) system. In. Read ()! ='q';i++) System. out. println(i)
3 Antworten
+ 11
Gaurav Dixit 🇮🇳 this is because when you press an enter key , it's counted as two characters ,
then the loop will run two times and wait for another input,
if you enter two characters then it will run 3 times ,and so on
if you press only an enter key then it will run only one time
+ 2
Joobin Jacob ( ܝܘܼܒܝܼܢ ܝܹܩܲܒ ) Thanks♥