About 81,700 results
Open links in new tab
  1. What is the correct way to declare a boolean variable in Java?

    Aug 1, 2016 · So, you should use boolean rather. Further, we initialize the boolean variable to false to hold an initial default value which is false. In case you have declared it as instance …

  2. How to return a boolean method in java? - Stack Overflow

    Jan 5, 2017 · Edit: Sometimes you can't return early because there's more work to be done. In that case you can declare a boolean variable and set it appropriately inside the conditional …

  3. if statement - if (boolean condition) in Java - Stack Overflow

    Oct 4, 2018 · boolean state = "TURNED ON"; is not a Java valid code. boolean can receive only boolean values (true or false) and "TURNED ON"is a String. EDIT: now you are talking about …

  4. Boolean expressions in Java - Stack Overflow

    Oct 25, 2010 · A Java conditional requires a boolean value. If you can put it into an if statement, it's already a boolean, and requires no further fiddling if what you want is a boolean. Indeed, …

  5. java - Junit testing for a boolean method - Stack Overflow

    You have a number of issues: you are attempting to call a non-static method statically; method names in java are case sensitive and you've mixed up the case.

  6. java - How to write a constructor that contains a boolean value ...

    You probably appropriately chose the primitive type boolean in your example but since you mentioned "Boolean" with a capital "B", there is a difference. Boolean variables are nullable …

  7. java - Checking Password Code - Stack Overflow

    /* 2. Write a Java method to check whether a string is a valid password. Password rules: A password must have at least ten characters. A password consists of only letters and digits. A …

  8. java - How to create boolean method? - Stack Overflow

    Feb 12, 2013 · I'm trying to create a boolean method called isAvailable that accepts a seat number on a flight as a parameter, returns a boolean that indicates whether that seat is …

  9. java - For a boolean field, what is the naming convention for its ...

    There is a markable point between setter/getter method of the data type Boolean and boolean in side a class ( for pojo/entity). For both Boolean and boolean the setter method should be …

  10. java - Using NOT operator in IF conditions - Stack Overflow

    Feb 19, 2020 · In general, ! is a perfectly good and readable boolean logic operator. No reason not to use it unless you're simplifying by removing double negatives or applying Morgan's …

Refresh