Boolean and for loop JAVA

int a=25: for (double i=1;i<=a;i++) { int b=5*i; boolean value= b==a; System.out.println(value); } This method is true when i=5 but false otherwise. So the value can be true at i=5 but my program will print for me : false-false-false-false-TRUE-false-false-false... how can I make this program to print just TRUE for me. PS: I know that false or false or TRUE or false = True.. but how can I use it in the for loop?
I cannot understand this code. I've also tested it and can never get a true out of this. b cannot ever equal i. Am I missing something in the code itself?

以上就是Boolean and for loop JAVA的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准