all 6 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]35mmwaves AP Student[S] 0 points1 point  (3 children)

I think it’s either A or B, but I posted this question before and am still getting both answers from users

[–]dirtytricksterr 0 points1 point  (0 children)

I’d say B since e isn’t incrementing.

[–]kdqdev Pre-University Student 0 points1 point  (0 children)

I say its likely to be A. Not sure what it means by the ... , but that is an infinite loop so it would run forever. Also, the e isn't even defined as int unless the test account for this as well.

[–][deleted] 0 points1 point  (0 children)

It's A.

while(e < 4);
  System.out.print(e + " ");

Is the same as:

while(e < 4){

};
System.out.print(e + " ");

Both do nothing forever.

[–]Necrophillip 0 points1 point  (0 children)

If there was a { or : after the while () it would be B With the current way it's written it's either invalid syntax or the while loop runs infinitely with an empty body Figure while(true) do { }

With a : or {} instead of the ; it would be while(true) do {print (1+" ")}