Merge remote-tracking branch 'upstream/master'

This commit is contained in:
JuhoKang
2016-02-03 22:49:59 +09:00
94 changed files with 953 additions and 86 deletions

View File

@ -2,18 +2,21 @@ package com.iluwatar.value.object;
/**
* App Class.
*
*/
public class App {
/**
* main method.
* A Value Object must check equality with equals() not == <br>
* This practice creates three HeroStats(Value object) and checks equality between those.
*/
public static void main(String[] args) {
HeroStat statA = HeroStat.valueOf(10, 5, 0);
HeroStat statB = HeroStat.valueOf(5, 1, 8);
HeroStat statB = HeroStat.valueOf(10, 5, 0);
HeroStat statC = HeroStat.valueOf(5, 1, 8);
System.out.println(statA.toString());
// When using Value Objects do not use ==, only compare using equals().
System.out.println("is statA and statB equal : " + statA.equals(statB));
System.out.println("Is statA and statB equal : " + statA.equals(statB));
System.out.println("Is statA and statC equal : " + statA.equals(statC));
}
}