r/badcode • • Jun 23 '20

java 'val' is a boolean value.

Post image
1.0k Upvotes

58 comments sorted by

View all comments

3

u/Mr2-1782Man Jun 23 '20

I think we can make this better:

public boolean isTrueP() {
  if (val == true) {
    val = true;
  else if (val == false) {
    val = false;
  }
  return val;
}