diff --git a/src/com/codefortomorrow/beginner/chapter2/examples/Variables.java b/src/com/codefortomorrow/beginner/chapter2/examples/Variables.java index 3adc394..dd80723 100644 --- a/src/com/codefortomorrow/beginner/chapter2/examples/Variables.java +++ b/src/com/codefortomorrow/beginner/chapter2/examples/Variables.java @@ -2,6 +2,7 @@ public class Variables { + @SuppressWarnings("unused") public static void main(String[] args) { String name; // declaration name = "Kaz"; // initialization diff --git a/src/com/codefortomorrow/beginner/chapter3/practice/FirstHalf.java b/src/com/codefortomorrow/beginner/chapter3/practice/FirstHalf.java index d14bb3a..605fcc2 100644 --- a/src/com/codefortomorrow/beginner/chapter3/practice/FirstHalf.java +++ b/src/com/codefortomorrow/beginner/chapter3/practice/FirstHalf.java @@ -14,6 +14,7 @@ public class FirstHalf { + @SuppressWarnings("unused") public static void main(String[] args) { String str1 = "WooHoo"; // should print "Woo" String str2 = "HelloThere"; // should print "Hello" diff --git a/src/com/codefortomorrow/beginner/chapter3/practice/WithoutEnd.java b/src/com/codefortomorrow/beginner/chapter3/practice/WithoutEnd.java index 936949c..5854a5c 100644 --- a/src/com/codefortomorrow/beginner/chapter3/practice/WithoutEnd.java +++ b/src/com/codefortomorrow/beginner/chapter3/practice/WithoutEnd.java @@ -15,6 +15,7 @@ public class WithoutEnd { + @SuppressWarnings("unused") public static void main(String[] args) { String str1 = "Hello"; // should print "ell" String str2 = "java"; // should print "av" diff --git a/src/com/codefortomorrow/beginner/chapter3/solutions/Initialize.java b/src/com/codefortomorrow/beginner/chapter3/solutions/Initialize.java index 6f29242..9a55660 100644 --- a/src/com/codefortomorrow/beginner/chapter3/solutions/Initialize.java +++ b/src/com/codefortomorrow/beginner/chapter3/solutions/Initialize.java @@ -14,6 +14,7 @@ public class Initialize { + @SuppressWarnings("unused") public static void main(String[] args) { boolean isRaining = false; double price = 5.68; diff --git a/src/com/codefortomorrow/beginner/chapter4/examples/Arithmetic.java b/src/com/codefortomorrow/beginner/chapter4/examples/Arithmetic.java index 4022f62..4ead928 100644 --- a/src/com/codefortomorrow/beginner/chapter4/examples/Arithmetic.java +++ b/src/com/codefortomorrow/beginner/chapter4/examples/Arithmetic.java @@ -4,21 +4,27 @@ public class Arithmetic { public static void main(String[] args) { // addition - int a = 5 + 1; // a has the value 6 + int a = 5 + 1; + System.out.println("a is " + a); // subtraction - double b = 25.6 - 90; // b has the value 64.4 + double b = 25.6 - 90; + System.out.println("b is " + b); // multiplication - int c = 12 * 4; // c has the value 48 + int c = 12 * 4; + System.out.println("c is " + c); // integer division - int d = 10 / 3; // d has the value 3 + int d = 10 / 3; + System.out.println("d is " + d); // double division - double e = 10.0 / 3; // e has the value 3.3333333... + double e = 10.0 / 3; + System.out.println("e is " + e); // modulus - int f = 10 % 3; // f has the value 1 + int f = 10 % 3; + System.out.println("f is " + f); } } diff --git a/src/com/codefortomorrow/beginner/chapter4/examples/AugmentedAssignment.java b/src/com/codefortomorrow/beginner/chapter4/examples/AugmentedAssignment.java index 16e2240..4127067 100644 --- a/src/com/codefortomorrow/beginner/chapter4/examples/AugmentedAssignment.java +++ b/src/com/codefortomorrow/beginner/chapter4/examples/AugmentedAssignment.java @@ -3,12 +3,23 @@ public class AugmentedAssignment { public static void main(String[] args) { - int a = 1; + int a = 10; + System.out.println("1. a is " + a); a += 1; // equivalent to a = a + 1; + System.out.println("2. a is " + a); + a -= 2; // equivalent to a = a - 2; + System.out.println("3. a is " + a); + a *= 3; // equivalent to a = a * 3; + System.out.println("4. a is " + a); + + // NOTE: In this case, we are doing integer division a /= 4; // equivalent to a = a / 4; + System.out.println("5. a is " + a); + a %= 5; // equivalent to a = a % 5; + System.out.println("6. a is " + a); } } diff --git a/src/com/codefortomorrow/beginner/chapter9/examples/InitializeArray.java b/src/com/codefortomorrow/beginner/chapter9/examples/InitializeArray.java index 4ee2d8f..1276147 100644 --- a/src/com/codefortomorrow/beginner/chapter9/examples/InitializeArray.java +++ b/src/com/codefortomorrow/beginner/chapter9/examples/InitializeArray.java @@ -2,6 +2,7 @@ public class InitializeArray { + @SuppressWarnings("unused") public static void main(String[] args) { // declare an array - can be initialized later // with either of the initialization methods below diff --git a/src/com/codefortomorrow/intermediate/chapter12/examples/WrapperClasses.java b/src/com/codefortomorrow/intermediate/chapter12/examples/WrapperClasses.java index bf81b9f..d8576c9 100644 --- a/src/com/codefortomorrow/intermediate/chapter12/examples/WrapperClasses.java +++ b/src/com/codefortomorrow/intermediate/chapter12/examples/WrapperClasses.java @@ -2,6 +2,7 @@ public class WrapperClasses { + @SuppressWarnings("unused") public static void main(String[] args) { // auto-boxing (int to Integer) Integer intObject = 2; diff --git a/src/com/codefortomorrow/intermediate/chapter12/practice/Account.java b/src/com/codefortomorrow/intermediate/chapter12/practice/Account.java index d87f957..4bdfe2b 100644 --- a/src/com/codefortomorrow/intermediate/chapter12/practice/Account.java +++ b/src/com/codefortomorrow/intermediate/chapter12/practice/Account.java @@ -4,6 +4,7 @@ Create a UML diagram for the Account class. */ +@SuppressWarnings("unused") public class Account { private String name;