What is a flag in java?
when do we need it in our program?
what it is used for?
engrjawad
0
Newbie Poster
Recommended Answers
Jump to Postbit little information to go on. can you put it in a context?
Jump to PostIt's rubbish coding by someone who hasn't heard of boolean variables.
Replace it by a boolean called numberHasADivisor, initially false, set true on line 9, and all should become obvious.
Jump to PostJust this one time...
I just replaced the stupid int with a boolean, and gave it a meaningful name. If this code still isn't clear then add some print statements to show how the values of the main variables change, and execute it yourself.class PrimeNo{ public …
All 9 Replies
stultuske
1,116
Posting Maven
Featured Poster
engrjawad
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
engrjawad
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
jalpesh_007
commented:
really good...
+2
engrjawad
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
jalpesh_007
-3
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.