-2

So, I'm more use to C++. Trying to get into Java was wondering how to fix this issue. So, as for C++ you can have a function declare return false or whatever if it wasn't filled in. how would I go about doing this in Java? I'm trying to have the declare toggled return false if it wasn't given a value. I get the error "The left-hand side of an assignment must be a variable" with what I have currently.

public Module(String name, String description, Category category, boolean toggled = false) {
    super();
    this.name = name;
    this.description = description;
    this.key = 0;
    this.category = category;
    this.toggled = toggled;
}
R3D
  • 1

0 Answers0