Answer:
Follows are the code to this question:
import java.util.*;//import package for user input
public class Main //defining class
{
public static void main(String[] as)//main method
{
boolean x,y,z;//defining boolean variable
Scanner ox= new Scanner(System.in);//create Scanner class object for user input
System.out.println("input value: "); //print message
x=ox.nextBoolean();//input value
y=ox.nextBoolean();//input value
z=ox.nextBoolean();//input value
System.out.println("Output: ");//print message
System.out.println(x || (y &&z));//use print method to check value and print its value
}
}
Output:
1)
input value:
true
false
false
Output:
true
2)
input value:
false
true
true
Output:
true
3)
input value:
false
false
false
Output:
false
Explanation:
In the given code, inside the class three boolean variable "x,y, and z" is declared, that uses the scanner class for input the value from the user end, and in the next print, the method is declared, that uses " OR and AND" gate for calculating the input value and print its value.
In the AND gate, when both conditions are true. it will print the value true, and in the OR gate, when one of the conditions is true, it will print the value true.