Home
Pre-Lab
In-Lab
Post-Lab
|
Java code to generate the truth table for AND:
import javax.swing.*;
public class LogicalOperator {
public static void main( String args[] ) {
// Create a truth table for && [ logical AND ] operator
String output = "\n\nLogical AND [&&]" +
"\nfalse && false: " + [ false && false ] +
"\nfalse && true: " + [ false && true ] +
"\ntrue && false: " + [ true && false ] +
"\ntrue && true: " + [ true && true ];
}
}

|