Printing attributes of type boolean in java [closed]

-1

Good morning! I'm starting now in Java and I have the following question: "Why does the tribute Boolean Monthly Rate not appear for me to display the reported result?" Below is the image of the options that appear when I press CTRL + SPACEBAR.

    
asked by anonymous 26.02.2018 / 15:36

2 answers

0

If you used the genereate get and set of eclipse, it places attributes of type boolean like isMensalidade()     

26.02.2018 / 15:56
1

In situations like this, you should go into the class and verify that the method you want has been declared.

When intellisense does not show the method / attribute, it means that either the method / attribute does not exist or the class that is trying to access it does not have permission to do so. For example, the method could be as private , in that case, even if the method existed you would not be able to see it by intellisense.

As already mentioned in the link response, if you generated the code through the IDE, the method is probably with the name isMensalidade() . IDEs normally insert code following the language pattern, in the case of Java, Boolean attributes follow this pattern of access methods:

private boolean hidden;

public void setHidden(boolean hidden) {
    this.hidden = hidden;
}

public boolean isHidden() {
    return this.hidden;
}
    
26.02.2018 / 16:38