diff --git a/ch04/HelloMethod.java b/ch04/HelloMethod.java new file mode 100644 index 0000000..5a7c5c0 --- /dev/null +++ b/ch04/HelloMethod.java @@ -0,0 +1,25 @@ +public class HelloMethod + +{ + public static void main(String[] args) + { + + printHelloWorld(" Fred"); + printOhNo(); + printHelloWorld(" Wilma"); + } + + public static void printHelloWorld(String name) + { + System.out.println("Hello World" + name); + + } + + public static void printOhNo() + { + + System.out.println("Oh NO!!!!!!!!!!!!!!!!!!!!!"); + } + + +} diff --git a/ch05/Comparison.java b/ch05/Comparison.java new file mode 100644 index 0000000..ec7fa47 --- /dev/null +++ b/ch05/Comparison.java @@ -0,0 +1,22 @@ +public class Comparison +{ + public static void main(String[] args) + { + String txt = "Fantastic"; + String lang = "Java"; + boolean state = (txt == lang); + System.out.println("String Equality Test: " + state); + + state = (txt != lang); + System.out.println("String Inequality Test: " + state); + + int dozen = 12; + int score = 20; + state = (dozen > score); + System.out.println("Greater Than Test: " + state); + state = (dozen < score); + System.out.println("Less than test: " + state); + + } + +}