+ 7
why return true or return false?
why some one use return true or false in method
2 Answers
+ 32
just for know that a required condition is true or not
//for example for knowing a number is prime or not , we can use boolean type in the method for checking prime
//hope it helps âș
+ 4
I like using true or false returns for the result of a method checking validity of data or testing a condition.
boolean isLeapYear(int year);
boolean checkDate(int month, int day, int year);