enter image description here enter image description here

I do not understand why the compiler swears?

Closed due to the fact that off-topic participants pavlofff , zRrr , Qwertiy ♦ , D-side , aleksandr barakin 8 May '16 at 9:47 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - zRrr, D-side, aleksandr barakin
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • because the method is called toStri n g () - etki
  • @ should? - Joks
  • one
    If you hover / click on the icon with the exclamation mark (to the left of the line), a window will appear with information that should help you, and if not, help us to understand what is wrong. - Sanek Zhitnik
  • you have it called toStrig () - etki
  • @Sanek Zhitnik added - Joks

1 answer 1

Your variable b3 has a primitive type, respectively, and the method is incorrect to call in this case.

Can you write this: b3 ? "True" : "False" b3 ? "True" : "False" .

Or use the class Boolean .

Or use the static toString method of the class Boolean : Boolean.toString(b3)

  • 2
    You can add to the response an application of type Boolean : Boolean.toString(b3) . I don’t remember whether automatic conversions are happening in this case, but you can just try jTextField.setText(b3) just in the forehead, it won't get any worse. - Sergey
  • @Pavel Parshin 'jTextField1.setText (boolean.toStrig (b3));' it swears vseravno - Joks
  • 2
    Boolean is a class spelled with a capital letter. The toString method is written in n - Pavel Parshin
  • @Pavel Parshin, thanks - Joks
  • You have Netbeans, it has a working code completion. Almost from the first letter offers options for the correct continuation. If it does not offer something in terms of calling methods, then you are doing something wrong. He could not offer a method call on a small boolean. - Sergey