DoCompare - System.out.println(); S firstBool = (-3 <=...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// File: DoCompare.java // Course: CSC 211 // Author: Amber Settle // Purpose: Demonstrate some basic integer comparisons / public class DoCompare { // Outputs the results of various integer comparisons / public static void main(String[] args) { boolean firstBool, secondBool; b firstBool = (0 == 0); System.out.println("Is 0 == 0? " + firstBool); secondBool = (5 == 0); System.out.println("Is 5 == 0? " + secondBool); System.out.println(); S firstBool = (1 != 1); System.out.println("Is 1 != 1? " + firstBool); secondBool = (1 != -2); System.out.println("Is 1 != -2? " + secondBool); System.out.println(); S firstBool = (5 < 12); System.out.println("Is 5 < 12? " + firstBool); secondBool = (0 < 0); System.out.println("Is 0 < 0? " + secondBool);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println(); S firstBool = (-3 <= -10); System.out.println("Is -3 <= -10? " + firstBool); secondBool = (0 <= 0); System.out.println("Is 0 <= 0? " + secondBool); System.out.println(); S firstBool = (11 > 11); System.out.println("Is 11 > 11? " + firstBool); secondBool = (11 > -4); System.out.println("Is 11 > -4? " + secondBool); System.out.println(); S firstBool = (11 >= 11); System.out.println("Is 11 >= 11? " + firstBool); secondBool = (11 >= 103); System.out.println("Is 11 >= 103? " + secondBool); System.out.println(); S // What does a Boolean value look like when printed? boolean thirdBool = false; System.out.println(thirdBool); S } }...
View Full Document

This note was uploaded on 03/05/2011 for the course CSC 211 taught by Professor Chan during the Spring '11 term at CA Health Sciences.

Ask a homework question - tutors are online