In: Computer Science
In the following class:
public class Truth
{
private boolean yes_no;
...
}
Create constructor, setter and getter methods, and toString method.


Code:
package assignment;
class Test{
   private boolean yes_no;
   Test( boolean yes_no){//class constructor
       this.yes_no=yes_no;
   }  
   //setter and getter methods
   public boolean isYes_no() {
       return yes_no;
   }
   public void setYes_no(boolean yes_no) {
       this.yes_no = yes_no;
   }
  
   @Override
   public String toString() {//toString methos
       return "yes_no=" + yes_no;
   }}
public class Const {
   public static void main(String[] args) {
       Test t=new Test(true);
       System.out.println(t);
   }}