java while loop -


why following result in infinite loop?

int sum = 0; int k = 1; while (sum < 12 || k < 4)     sum = sum + k; system.out.println(sum); 

how come sum doesn't increase stop while loop?

sum increase, k doesn't. condition uses or (||), condition true because k less 4.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -

java Extracting Zip file -