I am learning how to program in Java and I am doing an exercise where I have to print on the screen with printf
a Boolean variable. The variable in question is gender, which can be M or F.
Let's see the initialization of the variable:
boolean sex = true; // I set it to true because it gave me a Netbeans error and I did not know it was initialized, but I do not know how to set M to true and that F corresponds to false.
System.out.printf ("The value of the variable sex is% s% n", sex); // I think it would be fine that way, but I fail to guess that this will print true, but not M, that is what I want, because I do not know how to program what corresponds to true and what corresponds to false.
Thank you very much:)