How to get a boolean true or false to display a value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get a boolean true or false to display a value

I have code that says: If the married status is single return false or if they are married return true. When i display the boolean is only says false or true, is there a way to display single or married. Thanks

19th Oct 2016, 2:10 AM
Dan Roszhart
2 Answers
+ 1
yes, you can use print statement as follow: if(marriedStatus==single) { System.out.println("single"); return false; }else{ System.out.println("married"); return true; }
19th Oct 2016, 3:31 AM
Mani Kanta
Mani Kanta - avatar
0
Thanks
19th Oct 2016, 3:35 AM
Dan Roszhart