├── .gitignore
├── LICENSE
├── README.md
├── errata.md
├── exercises
├── CH03
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ └── Exercise2.java
├── CH04
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ ├── Exercise2.java
│ │ ├── Exercise3.java
│ │ └── Exercise4.java
├── CH05
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ ├── Exercise2.java
│ │ ├── Exercise3.java
│ │ └── Exercise4.java
├── CH06
│ ├── Exercise1
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── ArrayList.java
│ │ │ └── Demo.java
│ └── Exercise2
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── ArrayList.java
│ │ └── Demo.java
├── CH07
│ ├── Exercise1
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── CashCard.java
│ │ │ ├── CashCardDAO.java
│ │ │ ├── CashCardService.java
│ │ │ └── Exercise1.java
│ └── Exercise2
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── Exercise2.java
├── CH08
│ ├── Exercise1
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ └── virtual
│ │ │ └── CashCard.java
│ ├── Exercise2
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ └── virtual
│ │ │ ├── CashCard.java
│ │ │ └── InsufficientException.java
│ └── Exercise3
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── virtual
│ │ ├── CashCard.java
│ │ └── InsufficientException.java
├── CH09
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ ├── Exercise2.java
│ │ └── IterableString.java
├── CH10
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ ├── Exercise2.java
│ │ ├── Exercise3.java
│ │ ├── FileUtil.java
│ │ └── IOConsumer.java
├── CH11
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ ├── Request.java
│ │ ├── WorkerThread.java
│ │ └── WorkerThreadPool.java
├── CH12
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── ArrayList.java
│ │ └── Exercise.java
├── CH13
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise1.java
│ │ └── Exercise2.java
├── CH14
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── Exercise.java
├── CH15
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── Exercise.java
├── CH16
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Exercise.java
│ │ ├── JdbcTemplate.java
│ │ └── PreparedStatementSetter.java
├── CH17
│ └── Exercise
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── Exercise.java
└── CH18
│ └── Exercise
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── Client.java
│ ├── ClientAdded.java
│ ├── ClientEvent.java
│ ├── ClientListener.java
│ ├── ClientListenerInstaller.java
│ ├── ClientLogger.java
│ ├── ClientQueue.java
│ ├── ClientRemoved.java
│ └── Exercise.java
├── images
├── 10_11_typo_1.JPG
├── 10_17_typo_1.JPG
├── 10_7_typo_1.JPG
├── 10_8_typo_1.JPG
├── 11_13_typo_1.JPG
├── 11_17_typo_1.JPG
├── 11_20_typo_1.JPG
├── 11_22_typo_1.JPG
├── 11_23_typo_1.JPG
├── 11_27_typo_1.JPG
├── 11_28_typo_1.JPG
├── 11_30_typo_1.JPG
├── 11_33_typo_1.JPG
├── 11_44_typo_1.JPG
├── 11_53_typo_1.JPG
├── 12_13_typo_1.JPG
├── 12_16_typo_1.JPG
├── 12_18_typo_1.JPG
├── 12_19_typo_1.JPG
├── 12_27_typo_1.JPG
├── 12_28_typo_1.JPG
├── 12_29_typo_1.JPG
├── 12_35_typo_1.JPG
├── 12_36_typo_1.JPG
├── 12_36_typo_2.JPG
├── 12_3_typo_1.JPG
├── 12_41_typo_1.JPG
├── 12_46_typo_1.JPG
├── 12_48_typo_1.JPG
├── 12_48_typo_2.JPG
├── 13_18_typo_1.JPG
├── 13_19_typo_1.JPG
├── 13_7_typo_1.JPG
├── 13_8_typo_1.JPG
├── 13_9_typo_1.JPG
├── 13_9_typo_2.JPG
├── 14_15_typo_1.JPG
├── 14_19_typo_1.JPG
├── 14_20_typo_1.JPG
├── 14_28_typo_1.JPG
├── 14_3_typo_1.JPG
├── 14_4_typo_1.JPG
├── 14_5_typo_1.JPG
├── 15_12_typo_1.JPG
├── 15_27_typo_1.JPG
├── 15_32_typo_1.JPG
├── 15_3_typo_1.JPG
├── 16_10_typo_1.JPG
├── 16_10_typo_2.JPG
├── 16_13_typo_2.JPG
├── 16_15_typo_1.JPG
├── 16_21_typo_1.JPG
├── 16_21_typo_2.JPG
├── 16_25_typo_1.JPG
├── 16_28_typo_1.JPG
├── 16_30_typo_1.JPG
├── 16_31_typo_1.JPG
├── 16_32_typo_1.JPG
├── 16_39_typo_1.JPG
├── 16_40_typo_1.JPG
├── 16_40_typo_2.JPG
├── 16_47_typo_1.JPG
├── 16_49_typo_1.JPG
├── 16_51_typo_1.JPG
├── 16_53_typo_1.JPG
├── 16_9_typo_1.JPG
├── 17_11_typo_1.JPG
├── 17_15_typo_1.JPG
├── 17_19_typo_1.JPG
├── 17_25_typo_1.JPG
├── 17_26_typo_1.JPG
├── 17_5_typo_1.JPG
├── 18_16_typo_1.JPG
├── 18_22_typo_1.JPG
├── 18_23_typo_1.JPG
├── 18_25_typo_1.JPG
├── 18_27_typo_1.JPG
├── 18_9_typo_1.JPG
├── 1_13_typo_1.JPG
├── 1_2_typo_1.JPG
├── 1_9_typo_1.JPG
├── 2_15_typo_1.JPG
├── 2_18_typo_1.JPG
├── 2_19_typo_1.JPG
├── 2_20_typo_1.JPG
├── 3_14_typo_1.JPG
├── 3_25_typo_1.JPG
├── 4_13_typo_1.JPG
├── 4_17_typo_1.JPG
├── 4_19_typo_1.JPG
├── 4_25_typo_1.JPG
├── 4_32_typo_1.JPG
├── 4_5_typo_1.JPG
├── 4_8_typo_1.JPG
├── 5_14_typo_1.JPG
├── 5_18_typo_1.JPG
├── 5_24_typo_1.JPG
├── 5_34_typo_1.JPG
├── 6_10_typo_1.JPG
├── 6_14_typo_1.JPG
├── 6_32_typo_1.JPG
├── 6_34_typo_1.JPG
├── 6_38_typo_1.JPG
├── 7_23_typo_1.JPG
├── 7_9_typo_1.JPG
├── 8_24_typo_1.JPG
├── 9_10_typo_1.JPG
├── 9_13_typo_1.JPG
├── 9_16_typo_1.JPG
├── 9_26_typo_1.JPG
├── 9_6_typo_1.JPG
├── 9_7_typo_1.JPG
├── A_2_typo_1.JPG
├── v_typo_1.JPG
└── vii_typo_1.JPG
├── labs
├── CH02
│ └── Hello1
│ │ └── src
│ │ ├── Console.java
│ │ └── Main.java
├── CH04
│ ├── Array
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── CopyArray.java
│ │ │ ├── DeepCopy.java
│ │ │ ├── IntegerArray.java
│ │ │ ├── IrregularArray.java
│ │ │ ├── Scores.java
│ │ │ ├── Scores2.java
│ │ │ ├── ShallowCopy.java
│ │ │ └── XY.java
│ ├── ClassObject
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── config.properties
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── DecimalDemo.java
│ │ │ ├── DecimalDemo2.java
│ │ │ ├── Field.java
│ │ │ ├── Field2.java
│ │ │ ├── Guess.java
│ │ │ └── IntegerDemo.java
│ └── String
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── configs
│ │ │ └── Justin.properties
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── configs
│ │ │ │ └── Justin.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Average.java
│ │ ├── OneTo100.java
│ │ └── Sum.java
├── CH05
│ ├── Encapsulation2
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── CardApp.java
│ │ │ └── CashCard.java
│ ├── Encapsulation3
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── CardApp.java
│ │ │ └── CashCard.java
│ └── Public
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── CardApp.java
│ │ └── virtual
│ │ └── CashCard.java
├── CH06
│ ├── Game1
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── Game.java
│ │ │ ├── Magician.java
│ │ │ └── SwordsMan.java
│ ├── Game2
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── Game.java
│ │ │ ├── Magician.java
│ │ │ └── SwordsMan.java
│ ├── Game3
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── Magician.java
│ │ │ ├── RPG.java
│ │ │ ├── Role.java
│ │ │ └── SwordsMan.java
│ ├── Game4
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── Magician.java
│ │ │ ├── RPG.java
│ │ │ ├── Role.java
│ │ │ └── SwordsMan.java
│ ├── Game5
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── Magician.java
│ │ │ ├── RPG.java
│ │ │ ├── Role.java
│ │ │ └── SwordsMan.java
│ ├── Game6
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ ├── private.properties
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── src
│ │ │ └── cc
│ │ │ └── openhome
│ │ │ ├── Magician.java
│ │ │ ├── RPG.java
│ │ │ ├── Role.java
│ │ │ └── SwordsMan.java
│ └── Inheritance
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ │ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── ArrayList.java
│ │ ├── ConsoleGame.java
│ │ ├── Demo.java
│ │ ├── Guess.java
│ │ ├── GuessGame.java
│ │ └── Guest.java
└── CH07
│ ├── OceanWorld1
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Anemonefish.java
│ │ ├── Demo.java
│ │ ├── Fish.java
│ │ ├── Piranha.java
│ │ └── Shark.java
│ ├── OceanWorld2
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Anemonefish.java
│ │ ├── Demo.java
│ │ ├── Fish.java
│ │ ├── Human.java
│ │ ├── Ocean.java
│ │ ├── Piranha.java
│ │ ├── Shark.java
│ │ ├── Submarine.java
│ │ └── Swimmer.java
│ ├── OceanWorld3
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Anemonefish.java
│ │ ├── Demo.java
│ │ ├── Fish.java
│ │ ├── Human.java
│ │ ├── Ocean.java
│ │ ├── Piranha.java
│ │ ├── Shark.java
│ │ ├── Submarine.java
│ │ └── Swimmer.java
│ └── OceanWorld4
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── Anemonefish.java
│ ├── Demo.java
│ ├── Fish.java
│ ├── Flyer.java
│ ├── FlyingFish.java
│ ├── Human.java
│ ├── Ocean.java
│ ├── Piranha.java
│ ├── Seaplane.java
│ ├── Shark.java
│ ├── Submarine.java
│ └── Swimmer.java
└── samples
├── B
├── JNotePad
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── JNotePad.java
├── JNotePad2
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── JNotePad.java
├── JNotePad3
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── JNotePad.java
├── JNotePad4
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── JNotePad.java
├── JNotePad5
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── JNotePad.java
│ │ └── TextDAO.java
├── JNotePad6
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── FileTextDAO.java
│ │ ├── JNotePad.java
│ │ └── TextDAO.java
└── JNotePad7
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── FileTextDAO.java
│ ├── JNotePad.java
│ └── TextDAO.java
├── CH02
├── Hello1
│ └── src
│ │ ├── Some.java
│ │ └── cc
│ │ └── openhome
│ │ ├── Arrays.java
│ │ ├── Main.java
│ │ └── util
│ │ └── Console.java
├── Hello2
│ ├── build.xml
│ ├── build
│ │ ├── built-jar.properties
│ │ └── classes
│ │ │ ├── .netbeans_automatic_build
│ │ │ └── .netbeans_update_resources
│ ├── dist
│ │ └── README.TXT
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ └── Main.java
├── HelloWorld.java
└── Main.java
├── CH03
└── Basic
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── Bitwise.java
│ ├── Comparison.java
│ ├── Level.java
│ ├── Level2.java
│ ├── NineNineTable.java
│ ├── NineNineTable2.java
│ ├── Odd.java
│ ├── OneToTen.java
│ ├── RandomStop.java
│ ├── RandomStop2.java
│ ├── Range.java
│ └── Shift.java
├── CH04
├── Array
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── CopyArray.java
│ │ ├── DeepCopy.java
│ │ ├── IntegerArray.java
│ │ ├── IrregularArray.java
│ │ ├── Scores.java
│ │ ├── Scores2.java
│ │ ├── ShallowCopy.java
│ │ └── XY.java
├── ClassObject
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── DecimalDemo.java
│ │ ├── DecimalDemo2.java
│ │ ├── Field.java
│ │ ├── Field2.java
│ │ ├── Guess.java
│ │ └── IntegerDemo.java
└── String
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── configs
│ │ └── Justin.properties
│ ├── genfiles.properties
│ ├── private
│ │ ├── config.properties
│ │ ├── configs
│ │ │ └── Justin.properties
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── Average.java
│ ├── OneTo100.java
│ └── Sum.java
├── CH05
├── Class
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── CallByValue.java
│ │ ├── ImportStatic.java
│ │ ├── MathTool.java
│ │ ├── ObjectInitialBlock.java
│ │ └── OverloadBoxing.java
├── Encapsulation1
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── CardApp.java
│ │ └── CashCard.java
├── Encapsulation2
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── CardApp.java
│ │ └── CashCard.java
├── Encapsulation3
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── CardApp.java
│ │ └── CashCard.java
└── Public
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── CardApp.java
│ └── virtual
│ └── CashCard.java
├── CH06
├── Game1
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ └── private.properties
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Magician.java
│ │ ├── RPG.java
│ │ ├── Role.java
│ │ └── SwordsMan.java
├── Game2
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Magician.java
│ │ ├── RPG.java
│ │ ├── Role.java
│ │ └── SwordsMan.java
├── Game3
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Magician.java
│ │ ├── RPG.java
│ │ ├── Role.java
│ │ └── SwordsMan.java
├── Game4
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Magician.java
│ │ ├── RPG.java
│ │ ├── Role.java
│ │ └── SwordsMan.java
├── Game5
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Magician.java
│ │ ├── RPG.java
│ │ ├── Role.java
│ │ └── SwordsMan.java
├── Game6
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Magician.java
│ │ ├── RPG.java
│ │ ├── Role.java
│ │ └── SwordsMan.java
└── Inheritance
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── ArrayList.java
│ ├── ConsoleGame.java
│ ├── Guess.java
│ ├── GuessGame.java
│ └── Guest.java
├── CH07
├── Enum
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Action.java
│ │ └── Game.java
├── Interface
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ └── private.properties
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Action.java
│ │ ├── Client.java
│ │ ├── ClientEvent.java
│ │ ├── ClientListener.java
│ │ ├── ClientQueue.java
│ │ ├── Game.java
│ │ └── MultiChat.java
├── OceanWorld1
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ └── private.properties
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Anemonefish.java
│ │ ├── Fish.java
│ │ ├── Human.java
│ │ ├── Piranha.java
│ │ ├── Shark.java
│ │ ├── Submarine.java
│ │ └── Swimmer.java
├── OceanWorld2
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Anemonefish.java
│ │ ├── Fish.java
│ │ ├── Human.java
│ │ ├── Ocean.java
│ │ ├── Piranha.java
│ │ ├── Shark.java
│ │ ├── Submarine.java
│ │ └── Swimmer.java
├── OceanWorld3
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Anemonefish.java
│ │ ├── Fish.java
│ │ ├── Flyer.java
│ │ ├── FlyingFish.java
│ │ ├── Human.java
│ │ ├── Ocean.java
│ │ ├── Piranha.java
│ │ ├── Seaplane.java
│ │ ├── Shark.java
│ │ ├── Submarine.java
│ │ └── Swimmer.java
└── OceanWorld4
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── Airplane.java
│ ├── Anemonefish.java
│ ├── Boat.java
│ ├── Diver.java
│ ├── Fish.java
│ ├── Flyer.java
│ ├── FlyingFish.java
│ ├── Helicopter.java
│ ├── Human.java
│ ├── Ocean.java
│ ├── Piranha.java
│ ├── Seaplane.java
│ ├── Shark.java
│ ├── Submarine.java
│ ├── SwimPlayer.java
│ └── Swimmer.java
├── CH08
├── TryCatch
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── Average.java
│ │ ├── Average2.java
│ │ ├── Average3.java
│ │ ├── Average4.java
│ │ ├── FileUtil.java
│ │ ├── StackTraceDemo.java
│ │ ├── StackTraceDemo2.java
│ │ └── StackTraceDemo3.java
└── TryCatchFinally
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── AutoClosableDemo.java
│ ├── AutoClosableDemo2.java
│ ├── FileUtil.java
│ ├── FileUtil2.java
│ └── FinallyDemo.java
├── CH09
├── Collection
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── ArrayList.java
│ │ ├── Demo.java
│ │ ├── ForEach.java
│ │ ├── Guest.java
│ │ ├── RequestQueue.java
│ │ ├── RequestQueue2.java
│ │ ├── SimpleLinkedList.java
│ │ ├── Sort.java
│ │ ├── Sort2.java
│ │ ├── Sort3.java
│ │ ├── Sort4.java
│ │ ├── Sort5.java
│ │ ├── Sort6.java
│ │ ├── Stack.java
│ │ ├── Students.java
│ │ ├── Students2.java
│ │ └── WordCount.java
└── Map
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── config.properties
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ ├── person.properties
│ └── src
│ └── cc
│ └── openhome
│ ├── LoadProperties.java
│ ├── LoadSystemProps.java
│ ├── MapKeyValue.java
│ ├── MapKeyValue2.java
│ ├── MapKeyValue3.java
│ ├── Messages.java
│ ├── Messages2.java
│ └── Messages3.java
├── CH10
└── Stream
│ ├── B1234
│ ├── B5678
│ ├── B9876
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── BufferedIO.java
│ ├── CharUtil.java
│ ├── CharUtil2.java
│ ├── CharUtilDemo.java
│ ├── Copy.java
│ ├── Download.java
│ ├── IO.java
│ ├── Member.java
│ ├── Member2.java
│ ├── Member2Demo.java
│ ├── MemberDemo.java
│ ├── StandardIn.java
│ └── StandardOut.java
├── CH11
├── Concurrency
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── ArrayList.java
│ │ ├── ArrayList2.java
│ │ ├── ArrayList3.java
│ │ ├── Clerk.java
│ │ ├── Clerk2.java
│ │ ├── Consumer.java
│ │ ├── Consumer2.java
│ │ ├── Consumer3.java
│ │ ├── DirectExecutor.java
│ │ ├── Download.java
│ │ ├── Download2.java
│ │ ├── Download3.java
│ │ ├── FibonacciForkJoin.java
│ │ ├── FutureCallableDemo.java
│ │ ├── FutureCallableDemo2.java
│ │ ├── NoDeadLockDemo.java
│ │ ├── Pages.java
│ │ ├── Producer.java
│ │ ├── Producer2.java
│ │ ├── Producer3.java
│ │ ├── ProducerConsumerDemo.java
│ │ ├── ProducerConsumerDemo2.java
│ │ ├── ProducerConsumerDemo3.java
│ │ ├── ScheduledExecutorServiceDemo.java
│ │ ├── Test.java
│ │ └── ThreadPerTaskExecutor.java
└── Thread
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── ArrayList.java
│ ├── ArrayListDemo.java
│ ├── Clerk.java
│ ├── Consumer.java
│ ├── DaemonDemo.java
│ ├── DeadLockDemo.java
│ ├── Download.java
│ ├── Download2.java
│ ├── Hare.java
│ ├── InterruptedDemo.java
│ ├── JoinDemo.java
│ ├── Producer.java
│ ├── ProducerConsumerDemo.java
│ ├── ThreadGroupDemo.java
│ ├── ThreadGroupDemo2.java
│ ├── Tortoise.java
│ ├── TortoiseHareRace.java
│ ├── TortoiseHareRace2.java
│ ├── Variable1Test.java
│ ├── Variable2Test.java
│ └── Variable3Test.java
├── CH12
└── Lambda
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── Async.java
│ ├── CustomerDemo.java
│ ├── EmployeeDemo.java
│ ├── EmployeeDemo2.java
│ ├── LambdaDemo.java
│ ├── LineStartsWith.java
│ ├── MethodReferenceDemo.java
│ ├── PlayerDemo.java
│ ├── StringDemo.java
│ ├── StringOrder.java
│ ├── StringOrderDemo.java
│ ├── Test.java
│ ├── ThisDemo.java
│ └── ThisDemo2.java
├── CH13
└── DateCalendar
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── CalendarUtil.java
│ ├── CurrentTime.java
│ ├── DateDemo.java
│ ├── DateFormatDemo.java
│ ├── HowOld.java
│ ├── HowOld2.java
│ ├── MinguoDemo.java
│ ├── MonthDemo.java
│ ├── TimeZoneDemo.java
│ ├── TimeZoneDemo2.java
│ └── ZonedDateTimeDemo.java
├── CH14
├── NIO
│ ├── build.xml
│ ├── index.html
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── NIOUtil.java
│ │ └── Test.java
└── NIO2
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── BasicFileAttributesDemo.java
│ ├── ConsoleFileVisitor.java
│ ├── Dir.java
│ ├── DirAll.java
│ ├── Disk.java
│ ├── Download.java
│ ├── LS.java
│ ├── LS2.java
│ ├── PathDemo.java
│ └── Roots.java
├── CH15
├── I18N
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ ├── cc
│ │ └── openhome
│ │ │ └── Hello.java
│ │ ├── messages.properties
│ │ ├── messages_en_US.properties
│ │ └── messages_zh_TW.properties
├── Logging
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── FormatterDemo.java
│ │ ├── HandlerDemo.java
│ │ ├── LoggerDemo.java
│ │ └── LoggerDemo2.java
└── Regex
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── PatternMatcherDemo.java
│ ├── Regex.java
│ ├── ReplaceDemo.java
│ ├── SplitDemo.java
│ ├── SplitDemo2.java
│ ├── SplitDemo3.java
│ └── Test.java
├── CH16
└── JDBCDemo
│ ├── build.xml
│ ├── jdbc.properties
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── ColumnInfo.java
│ ├── ConnectionDemo.java
│ ├── Message.java
│ ├── MessageDAO.java
│ ├── MessageDAO2.java
│ ├── MessageDAO3.java
│ ├── MessageDAO4.java
│ ├── MessageDAODemo.java
│ ├── MessageDAODemo2.java
│ ├── MessageDAODemo3.java
│ ├── MessageDAODemo4.java
│ ├── SimpleConnectionPoolDataSource.java
│ ├── TMessageInfo.java
│ ├── TMessageInfoDemo.java
│ └── TMessageUtil.java
├── CH17
├── ClassLoader
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── cc
│ │ └── openhome
│ │ ├── ClassLoaderDemo.java
│ │ ├── ClassLoaderHierarchy.java
│ │ └── Some.java
└── Reflection
│ ├── build.xml
│ ├── manifest.mf
│ ├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
│ └── src
│ └── cc
│ └── openhome
│ ├── ArrayList.java
│ ├── BeanUtil.java
│ ├── ClassInfo.java
│ ├── ClassViewer.java
│ ├── ConsolePlayer.java
│ ├── Hello.java
│ ├── HelloSpeaker.java
│ ├── InfoAbout.java
│ ├── LoggingHandler.java
│ ├── MediaMaster.java
│ ├── Player.java
│ ├── ProxyDemo.java
│ ├── Some.java
│ ├── SomeDemo.java
│ ├── SomeDemo2.java
│ └── Student.java
└── CH18
├── Annotation
├── build.xml
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── cc
│ └── openhome
│ ├── Debug.java
│ ├── DebugTool.java
│ ├── Email.java
│ ├── Filter.java
│ ├── Ignore.java
│ ├── MailBox.java
│ ├── Other.java
│ ├── SecurityFilter.java
│ ├── SecurityTool.java
│ ├── Some.java
│ ├── SomeTestCase.java
│ ├── Test.java
│ ├── Test10.java
│ ├── Test11.java
│ ├── Test2.java
│ ├── Test3.java
│ ├── Test4.java
│ ├── Test5.java
│ ├── Test6.java
│ ├── Test7.java
│ ├── Test8.java
│ ├── Test9.java
│ ├── TestClass.java
│ └── Util.java
├── Enum
├── build.xml
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── cc
│ └── openhome
│ ├── Action.java
│ ├── Action2.java
│ ├── Action3.java
│ ├── Command.java
│ ├── Game.java
│ ├── Game3.java
│ ├── GameDemo.java
│ ├── Priority.java
│ └── Priority2.java
└── Generics
├── build.xml
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── private
│ ├── private.properties
│ └── private.xml
├── project.properties
└── project.xml
└── src
└── cc
└── openhome
├── Basket.java
├── ContravarianceDemo.java
├── CovarianceDemo.java
├── Demo.java
├── Fruit.java
├── Node.java
├── Sort.java
└── SortDemo.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 |
11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12 | hs_err_pid*
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | All Rights Reserved.
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | JavaSE8Tutorial
2 | ===============
3 |
4 | Java SE 8 技術手冊
5 |
6 | - [書中範例(含錄影檔)下載](http://dlcenter.gotop.com.tw/SampleFiles/ACL042200/download/javase8_techbook_resources.zip)
7 | - [課後解答下載](http://openhome.cc/upload/javase8-exercises.zip)
8 | - [一刷勘誤](errata.md)
9 |
10 |
--------------------------------------------------------------------------------
/exercises/CH03/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH03/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH03/Exercise/src/cc/openhome/Exercise1.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Exercise1 {
4 | public static void main(String[] args) {
5 | int m = 1000;
6 | int n = 495;
7 | while(n != 0) {
8 | int r = m % n;
9 | m = n;
10 | n = r;
11 | }
12 | System.out.printf("最大公因數 %d%n", m);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/exercises/CH03/Exercise/src/cc/openhome/Exercise2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Exercise2 {
4 | public static void main(String[] args) {
5 | for(int i = 100; i < 1000; i++) {
6 | if (Math.pow(i / 100, 3) + Math.pow((i % 100) / 10, 3) + Math.pow(i % 10, 3) == i) {
7 | System.out.printf("%d ", i);
8 | }
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/exercises/CH04/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH04/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH05/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH05/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH06/Exercise1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH06/Exercise1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH06/Exercise1/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Demo {
4 | public static void main(String[] args) {
5 | ArrayList list = new ArrayList();
6 | list.add("Justin");
7 | list.add("Monica");
8 | list.add("Irene");
9 | System.out.println(list);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/exercises/CH06/Exercise2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH06/Exercise2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise1/src/cc/openhome/CashCardDAO.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface CashCardDAO {
4 | void save(CashCard cashCard);
5 | CashCard load(String number);
6 | }
7 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise1/src/cc/openhome/CashCardService.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class CashCardService {
4 | private CashCardDAO dao;
5 |
6 | public CashCardService(CashCardDAO dao) {
7 | this.dao = dao;
8 | }
9 |
10 | public void save(CashCard cashCard) {
11 | dao.save(cashCard);
12 | }
13 |
14 | public CashCard load(String number) {
15 | return dao.load(number);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise1/src/cc/openhome/Exercise1.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Exercise1 {
4 | public static void main(String[] args) {
5 |
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH07/Exercise2/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/Exercise2/src/cc/openhome/Exercise2.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise2/src/cc/openhome/virtual/InsufficientException.java:
--------------------------------------------------------------------------------
1 | package cc.openhome.virtual;
2 |
3 | public class InsufficientException extends Exception {
4 | private int remain;
5 | public InsufficientException(String message, int remain) {
6 | super(message);
7 | this.remain = remain;
8 | }
9 | public int getRemain() {
10 | return remain;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise3/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/exercises/CH08/Exercise3/nbproject/private/config.properties
--------------------------------------------------------------------------------
/exercises/CH08/Exercise3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/exercises/CH08/Exercise3/src/cc/openhome/virtual/InsufficientException.java:
--------------------------------------------------------------------------------
1 | package cc.openhome.virtual;
2 |
3 | public class InsufficientException extends Exception {
4 | private int remain;
5 | public InsufficientException(String message, int remain) {
6 | super(message);
7 | this.remain = remain;
8 | }
9 | public int getRemain() {
10 | return remain;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/exercises/CH09/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH09/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH09/Exercise/src/cc/openhome/Exercise1.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Exercise1 {
4 | public static void main(String[] args) {
5 | for(Character c : new IterableString("Justin")) {
6 | System.out.println(c);
7 | }
8 |
9 | new IterableString("Monica").forEach(c -> System.out.println(c));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/exercises/CH10/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH10/Exercise/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/exercises/CH10/Exercise/nbproject/private/config.properties
--------------------------------------------------------------------------------
/exercises/CH10/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
7 |
--------------------------------------------------------------------------------
/exercises/CH10/Exercise/src/cc/openhome/Exercise3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Scanner;
4 | import static cc.openhome.FileUtil.open;
5 |
6 | public class Exercise3 {
7 | public static void main(String[] args) {
8 | open(args[0], fileInputStream -> {
9 | Scanner file = new Scanner(fileInputStream);
10 | while(file.hasNextLine()) {
11 | System.out.println(file.nextLine());
12 | }
13 | });
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/exercises/CH10/Exercise/src/cc/openhome/FileUtil.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 |
5 | public class FileUtil {
6 | public static void open(String fileName, IOConsumer consumer) {
7 | try(FileInputStream in = new FileInputStream(fileName)) {
8 | consumer.accept(in);
9 | } catch(IOException ex) {
10 | throw new UncheckedIOException(ex);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/exercises/CH10/Exercise/src/cc/openhome/IOConsumer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.IOException;
4 |
5 | public interface IOConsumer {
6 | void accept(T t) throws IOException;
7 | }
8 |
--------------------------------------------------------------------------------
/exercises/CH11/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH11/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH11/Exercise/src/cc/openhome/Request.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public interface Request {
3 | void execute();
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/exercises/CH12/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH12/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH13/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH13/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH14/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH14/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH14/Exercise/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/Exercise/src/cc/openhome/Exercise.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/exercises/CH15/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH15/Exercise/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/exercises/CH15/Exercise/nbproject/private/config.properties
--------------------------------------------------------------------------------
/exercises/CH15/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
7 |
--------------------------------------------------------------------------------
/exercises/CH15/Exercise/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/Exercise/src/cc/openhome/Exercise.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/exercises/CH16/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH16/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH16/Exercise/src/cc/openhome/PreparedStatementSetter.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.sql.PreparedStatement;
4 | import java.sql.SQLException;
5 |
6 | public interface PreparedStatementSetter {
7 | void setValues(PreparedStatement ps) throws SQLException;
8 | }
9 |
--------------------------------------------------------------------------------
/exercises/CH17/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH17/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH17/Exercise/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/Exercise/src/cc/openhome/Exercise.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/src/cc/openhome/Client.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Client {
4 | public final String ip;
5 | public final String name;
6 | public Client(String ip, String name) {
7 | this.ip = ip;
8 | this.name = name;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/src/cc/openhome/ClientAdded.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.*;
4 | @Retention(RetentionPolicy.RUNTIME)
5 | public @interface ClientAdded {}
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/src/cc/openhome/ClientEvent.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ClientEvent {
4 | private Client client;
5 | public ClientEvent(Client client) {
6 | this.client = client;
7 | }
8 |
9 | public String getName() {
10 | return client.name;
11 | }
12 |
13 | public String getIp() {
14 | return client.ip;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/src/cc/openhome/ClientListener.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface ClientListener {
4 | void clientAdded(ClientEvent event);
5 | void clientRemoved(ClientEvent event);
6 | }
7 |
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/src/cc/openhome/ClientLogger.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import static java.lang.System.out;
4 |
5 | public class ClientLogger {
6 | @ClientAdded
7 | public void clientAdded(ClientEvent event) {
8 | out.println(event.getIp() + " added...");
9 | }
10 |
11 | @ClientRemoved
12 | public void clientRemoved(ClientEvent event) {
13 | out.println(event.getIp() + " removed...");
14 | }
15 | }
--------------------------------------------------------------------------------
/exercises/CH18/Exercise/src/cc/openhome/ClientRemoved.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.*;
4 | @Retention(RetentionPolicy.RUNTIME)
5 | public @interface ClientRemoved {}
--------------------------------------------------------------------------------
/images/10_11_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/10_11_typo_1.JPG
--------------------------------------------------------------------------------
/images/10_17_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/10_17_typo_1.JPG
--------------------------------------------------------------------------------
/images/10_7_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/10_7_typo_1.JPG
--------------------------------------------------------------------------------
/images/10_8_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/10_8_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_13_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_13_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_17_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_17_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_20_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_20_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_22_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_22_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_23_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_23_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_27_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_27_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_28_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_28_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_30_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_30_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_33_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_33_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_44_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_44_typo_1.JPG
--------------------------------------------------------------------------------
/images/11_53_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/11_53_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_13_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_13_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_16_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_16_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_18_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_18_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_19_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_19_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_27_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_27_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_28_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_28_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_29_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_29_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_35_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_35_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_36_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_36_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_36_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_36_typo_2.JPG
--------------------------------------------------------------------------------
/images/12_3_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_3_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_41_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_41_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_46_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_46_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_48_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_48_typo_1.JPG
--------------------------------------------------------------------------------
/images/12_48_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/12_48_typo_2.JPG
--------------------------------------------------------------------------------
/images/13_18_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/13_18_typo_1.JPG
--------------------------------------------------------------------------------
/images/13_19_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/13_19_typo_1.JPG
--------------------------------------------------------------------------------
/images/13_7_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/13_7_typo_1.JPG
--------------------------------------------------------------------------------
/images/13_8_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/13_8_typo_1.JPG
--------------------------------------------------------------------------------
/images/13_9_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/13_9_typo_1.JPG
--------------------------------------------------------------------------------
/images/13_9_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/13_9_typo_2.JPG
--------------------------------------------------------------------------------
/images/14_15_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_15_typo_1.JPG
--------------------------------------------------------------------------------
/images/14_19_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_19_typo_1.JPG
--------------------------------------------------------------------------------
/images/14_20_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_20_typo_1.JPG
--------------------------------------------------------------------------------
/images/14_28_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_28_typo_1.JPG
--------------------------------------------------------------------------------
/images/14_3_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_3_typo_1.JPG
--------------------------------------------------------------------------------
/images/14_4_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_4_typo_1.JPG
--------------------------------------------------------------------------------
/images/14_5_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/14_5_typo_1.JPG
--------------------------------------------------------------------------------
/images/15_12_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/15_12_typo_1.JPG
--------------------------------------------------------------------------------
/images/15_27_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/15_27_typo_1.JPG
--------------------------------------------------------------------------------
/images/15_32_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/15_32_typo_1.JPG
--------------------------------------------------------------------------------
/images/15_3_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/15_3_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_10_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_10_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_10_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_10_typo_2.JPG
--------------------------------------------------------------------------------
/images/16_13_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_13_typo_2.JPG
--------------------------------------------------------------------------------
/images/16_15_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_15_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_21_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_21_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_21_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_21_typo_2.JPG
--------------------------------------------------------------------------------
/images/16_25_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_25_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_28_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_28_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_30_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_30_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_31_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_31_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_32_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_32_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_39_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_39_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_40_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_40_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_40_typo_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_40_typo_2.JPG
--------------------------------------------------------------------------------
/images/16_47_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_47_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_49_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_49_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_51_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_51_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_53_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_53_typo_1.JPG
--------------------------------------------------------------------------------
/images/16_9_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/16_9_typo_1.JPG
--------------------------------------------------------------------------------
/images/17_11_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/17_11_typo_1.JPG
--------------------------------------------------------------------------------
/images/17_15_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/17_15_typo_1.JPG
--------------------------------------------------------------------------------
/images/17_19_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/17_19_typo_1.JPG
--------------------------------------------------------------------------------
/images/17_25_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/17_25_typo_1.JPG
--------------------------------------------------------------------------------
/images/17_26_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/17_26_typo_1.JPG
--------------------------------------------------------------------------------
/images/17_5_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/17_5_typo_1.JPG
--------------------------------------------------------------------------------
/images/18_16_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/18_16_typo_1.JPG
--------------------------------------------------------------------------------
/images/18_22_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/18_22_typo_1.JPG
--------------------------------------------------------------------------------
/images/18_23_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/18_23_typo_1.JPG
--------------------------------------------------------------------------------
/images/18_25_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/18_25_typo_1.JPG
--------------------------------------------------------------------------------
/images/18_27_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/18_27_typo_1.JPG
--------------------------------------------------------------------------------
/images/18_9_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/18_9_typo_1.JPG
--------------------------------------------------------------------------------
/images/1_13_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/1_13_typo_1.JPG
--------------------------------------------------------------------------------
/images/1_2_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/1_2_typo_1.JPG
--------------------------------------------------------------------------------
/images/1_9_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/1_9_typo_1.JPG
--------------------------------------------------------------------------------
/images/2_15_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/2_15_typo_1.JPG
--------------------------------------------------------------------------------
/images/2_18_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/2_18_typo_1.JPG
--------------------------------------------------------------------------------
/images/2_19_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/2_19_typo_1.JPG
--------------------------------------------------------------------------------
/images/2_20_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/2_20_typo_1.JPG
--------------------------------------------------------------------------------
/images/3_14_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/3_14_typo_1.JPG
--------------------------------------------------------------------------------
/images/3_25_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/3_25_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_13_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_13_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_17_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_17_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_19_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_19_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_25_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_25_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_32_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_32_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_5_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_5_typo_1.JPG
--------------------------------------------------------------------------------
/images/4_8_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/4_8_typo_1.JPG
--------------------------------------------------------------------------------
/images/5_14_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/5_14_typo_1.JPG
--------------------------------------------------------------------------------
/images/5_18_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/5_18_typo_1.JPG
--------------------------------------------------------------------------------
/images/5_24_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/5_24_typo_1.JPG
--------------------------------------------------------------------------------
/images/5_34_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/5_34_typo_1.JPG
--------------------------------------------------------------------------------
/images/6_10_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/6_10_typo_1.JPG
--------------------------------------------------------------------------------
/images/6_14_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/6_14_typo_1.JPG
--------------------------------------------------------------------------------
/images/6_32_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/6_32_typo_1.JPG
--------------------------------------------------------------------------------
/images/6_34_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/6_34_typo_1.JPG
--------------------------------------------------------------------------------
/images/6_38_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/6_38_typo_1.JPG
--------------------------------------------------------------------------------
/images/7_23_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/7_23_typo_1.JPG
--------------------------------------------------------------------------------
/images/7_9_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/7_9_typo_1.JPG
--------------------------------------------------------------------------------
/images/8_24_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/8_24_typo_1.JPG
--------------------------------------------------------------------------------
/images/9_10_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/9_10_typo_1.JPG
--------------------------------------------------------------------------------
/images/9_13_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/9_13_typo_1.JPG
--------------------------------------------------------------------------------
/images/9_16_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/9_16_typo_1.JPG
--------------------------------------------------------------------------------
/images/9_26_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/9_26_typo_1.JPG
--------------------------------------------------------------------------------
/images/9_6_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/9_6_typo_1.JPG
--------------------------------------------------------------------------------
/images/9_7_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/9_7_typo_1.JPG
--------------------------------------------------------------------------------
/images/A_2_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/A_2_typo_1.JPG
--------------------------------------------------------------------------------
/images/v_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/v_typo_1.JPG
--------------------------------------------------------------------------------
/images/vii_typo_1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/images/vii_typo_1.JPG
--------------------------------------------------------------------------------
/labs/CH02/Hello1/src/Console.java:
--------------------------------------------------------------------------------
1 | public class Console {
2 | public static void writeLine(String text) {
3 | System.out.println(text);
4 | }
5 | }
--------------------------------------------------------------------------------
/labs/CH02/Hello1/src/Main.java:
--------------------------------------------------------------------------------
1 | public class Main {
2 | public static void main(String[] args) {
3 | Console.writeLine("Hello World");
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/labs/CH04/Array/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH04/Array/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH04/Array/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/labs/CH04/Array/src/cc/openhome/IrregularArray.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class IrregularArray {
4 | public static void main(String[] args) {
5 | /*
6 | * 補上程式碼
7 | */
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/labs/CH04/Array/src/cc/openhome/Scores.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Scores {
4 | public static void main(String[] args) {
5 | int[] scores = {88, 81, 74, 68, 78, 76, 77, 85, 95, 93};
6 | for(int i = 0; i < scores.length; i++) {
7 | System.out.printf("學生分數:%d %n", scores[i]);
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/labs/CH04/Array/src/cc/openhome/Scores2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 |
5 | public class Scores2 {
6 | public static void main(String[] args) {
7 | int[] scores = new int[10];
8 | for(int score : scores) {
9 | System.out.printf("%2d", score);
10 | }
11 | System.out.println();
12 | Arrays.fill(scores, 60);
13 | for(int score : scores) {
14 | System.out.printf("%3d", score);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/labs/CH04/Array/src/cc/openhome/XY.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class XY {
4 |
5 | public static void main(String[] args) {
6 | int[][] cords = {
7 | {1, 2, 3},
8 | {4, 5, 6}
9 | };
10 | /*
11 | * 補上程式碼
12 | * /
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/labs/CH04/ClassObject/nbproject/private/config.properties
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/src/cc/openhome/DecimalDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class DecimalDemo {
6 | public static void main(String[] args) {
7 | BigDecimal operand1 = new BigDecimal("1.0");
8 | BigDecimal operand2 = new BigDecimal("0.8");
9 | BigDecimal result = operand1.subtract(operand2);
10 | System.out.println(result);
11 | }
12 | }
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/src/cc/openhome/DecimalDemo2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class DecimalDemo2 {
6 | public static void main(String[] args) {
7 | /*
8 | * 補上程式碼
9 | */
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/labs/CH04/ClassObject/src/cc/openhome/Guess.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Scanner;
4 |
5 | public class Guess {
6 | public static void main(String[] args) {
7 | // 補上程式碼
8 | int number = (int) (Math.random() * 10);
9 | int guess;
10 |
11 | do {
12 | System.out.print("猜數字(0 ~ 9):");
13 | guess = // 補上程式碼
14 | } while(guess != number);
15 |
16 | System.out.println("猜中了...XD");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/labs/CH04/String/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH04/String/nbproject/configs/Justin.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/labs/CH04/String/nbproject/configs/Justin.properties
--------------------------------------------------------------------------------
/labs/CH04/String/nbproject/private/config.properties:
--------------------------------------------------------------------------------
1 | config=Justin
2 |
--------------------------------------------------------------------------------
/labs/CH04/String/nbproject/private/configs/Justin.properties:
--------------------------------------------------------------------------------
1 | application.args=1 2 3 4 5
2 |
--------------------------------------------------------------------------------
/labs/CH04/String/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/labs/CH04/String/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/labs/CH04/String/src/cc/openhome/Average.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Average {
4 | public static void main(String[] args) {
5 | long sum = 0;
6 | for(String arg : args) {
7 | sum += Long.parseLong(arg);
8 | }
9 | System.out.println("平均:" + (float) sum / args.length);
10 | }
11 | }
--------------------------------------------------------------------------------
/labs/CH04/String/src/cc/openhome/OneTo100.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class OneTo100 {
4 | public static void main(String[] args) {
5 | /*
6 | * 怎麼顯示1+2+3+.....+100?
7 | */
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/labs/CH04/String/src/cc/openhome/Sum.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Scanner;
4 |
5 | public class Sum {
6 | public static void main(String[] args) {
7 | Scanner console = new Scanner(System.in);
8 | long sum = 0;
9 | long number = 0;
10 |
11 | /*
12 | 補上程式碼
13 | */
14 |
15 | System.out.println("總合:" + sum);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation2/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation2/src/cc/openhome/CashCard.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | class CashCard {
4 | String number;
5 | int balance;
6 | int bonus;
7 | CashCard(String number, int balance, int bonus) {
8 | this.number = number;
9 | this.balance = balance;
10 | this.bonus = bonus;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH05/Encapsulation3/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/labs/CH05/Public/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH05/Public/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH05/Public/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/labs/CH06/Game1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Game1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Game1/src/cc/openhome/Game.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Game {
12 |
13 | /**
14 | * @param args the command line arguments
15 | */
16 | public static void main(String[] args) {
17 | // TODO code application logic here
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH06/Game2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Game2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Game2/src/cc/openhome/Game.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Game {
12 |
13 | /**
14 | * @param args the command line arguments
15 | */
16 | public static void main(String[] args) {
17 | // TODO code application logic here
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH06/Game3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Game3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Game3/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | public void fight() {
5 | System.out.println("魔法攻擊");
6 | }
7 |
8 | public void cure() {
9 | System.out.println("魔法治療");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/labs/CH06/Game3/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | public void fight() {
5 | System.out.println("揮劍攻擊");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/labs/CH06/Game4/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Game4/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Game4/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | public void fight() {
5 | System.out.println("魔法攻擊");
6 | }
7 |
8 | public void cure() {
9 | System.out.println("魔法治療");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/labs/CH06/Game4/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | public void fight() {
5 | System.out.println("揮劍攻擊");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/labs/CH06/Game5/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Game5/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Game5/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | file:/C:/workspace/Game5/src/cc/openhome/RPG.java
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/labs/CH06/Game5/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | public void fight() {
5 | System.out.println("魔法攻擊");
6 | }
7 |
8 | public void cure() {
9 | System.out.println("魔法治療");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/labs/CH06/Game5/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | public void fight() {
5 | System.out.println("揮劍攻擊");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/labs/CH06/Game6/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Game6/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Game6/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/labs/CH06/Game6/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | public void fight() {
5 | System.out.println("魔法攻擊");
6 | }
7 |
8 | public void cure() {
9 | System.out.println("魔法治療");
10 | }
11 |
12 | public String toString() {
13 | return String.format("魔法師 (%s, %d, %d)", this.name,
14 | this.level, this.blood);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/labs/CH06/Game6/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | public void fight() {
5 | System.out.println("揮劍攻擊");
6 | }
7 |
8 | public String toString() {
9 | return String.format("劍士 (%s, %d, %d)", this.name,
10 | this.level, this.blood);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH06/Inheritance/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH06/Inheritance/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH06/Inheritance/src/cc/openhome/ArrayList.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 |
5 | public class ArrayList {
6 | /*
7 | * 完成程式內容
8 | */
9 | }
10 |
--------------------------------------------------------------------------------
/labs/CH06/Inheritance/src/cc/openhome/ConsoleGame.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ConsoleGame extends GuessGame {
6 | /*
7 | 實作程式內容
8 | */
9 | }
10 |
--------------------------------------------------------------------------------
/labs/CH06/Inheritance/src/cc/openhome/Guess.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Guess {
4 | public static void main(String[] args) {
5 | GuessGame game = new ConsoleGame();
6 | game.go();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/labs/CH06/Inheritance/src/cc/openhome/GuessGame.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class GuessGame {
4 | /*
5 | * 實作程式內容
6 | *
7 | */
8 | }
9 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Demo {
12 |
13 | /**
14 | * @param args the command line arguments
15 | */
16 | public static void main(String[] args) {
17 | // TODO code application logic here
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | public abstract void swim();
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld1/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Demo {
12 |
13 | /**
14 | * @param args the command line arguments
15 | */
16 | public static void main(String[] args) {
17 | // TODO code application logic here
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human implements Swimmer {
4 | private String name;
5 |
6 | public Human(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("人類 %s 游泳%n", name);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine implements Swimmer {
4 | private String name;
5 |
6 | public Submarine(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("潛水艇 %s 潛行%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld2/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/OceanWorld3/src/cc/openhome/Ocean.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Demo {
12 |
13 | /**
14 | * @param args the command line arguments
15 | */
16 | public static void main(String[] args) {
17 | // TODO code application logic here
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human implements Swimmer {
4 | private String name;
5 |
6 | public Human(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("人類 %s 游泳%n", name);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Ocean.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Ocean {
4 | public static void main(String[] args) {
5 | doSwim(new Anemonefish("尼莫"));
6 | doSwim(new Shark("蘭尼"));
7 | doSwim(new Human("賈斯汀"));
8 | doSwim(new Submarine("黃色一號"));
9 | }
10 |
11 | static void doSwim(Swimmer swimmer) {
12 | swimmer.swim();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine implements Swimmer {
4 | private String name;
5 |
6 | public Submarine(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("潛水艇 %s 潛行%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld3/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/OceanWorld4/src/cc/openhome/Ocean.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Demo {
12 |
13 | /**
14 | * @param args the command line arguments
15 | */
16 | public static void main(String[] args) {
17 | // TODO code application logic here
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Flyer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Flyer {
4 | public abstract void fly();
5 | }
6 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/FlyingFish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class FlyingFish extends Fish implements Flyer {
4 | public FlyingFish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.println("飛魚游泳");
11 | }
12 |
13 | @Override
14 | public void fly() {
15 | System.out.println("飛魚會飛");
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human implements Swimmer {
4 | private String name;
5 |
6 | public Human(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("人類 %s 游泳%n", name);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Ocean.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Ocean {
4 | public static void main(String[] args) {
5 | doSwim(new Anemonefish("尼莫"));
6 | doSwim(new Shark("蘭尼"));
7 | doSwim(new Human("賈斯汀"));
8 | doSwim(new Submarine("黃色一號"));
9 |
10 | doSwim(new Seaplane("空軍零號"));
11 | doSwim(new FlyingFish("甚平"));
12 | }
13 |
14 | static void doSwim(Swimmer swimmer) {
15 | swimmer.swim();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Seaplane.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Seaplane implements Swimmer, Flyer {
4 | private String name;
5 |
6 | public Seaplane(String name) {
7 | this.name = name;
8 | }
9 |
10 | @Override
11 | public void fly() {
12 | System.out.printf("海上飛機 %s 在飛%n", name);
13 | }
14 |
15 | @Override
16 | public void swim() {
17 | System.out.printf("海上飛機 %s 航行海面%n", name);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine implements Swimmer {
4 | private String name;
5 |
6 | public Submarine(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("潛水艇 %s 潛行%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/labs/CH07/OceanWorld4/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/B/JNotePad/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/JNotePad/src/cc/openhome/JNotePad.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/B/JNotePad2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad2/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/JNotePad2/src/cc/openhome/JNotePad.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/B/JNotePad3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad3/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/JNotePad3/src/cc/openhome/JNotePad.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/B/JNotePad4/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad4/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad4/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/JNotePad4/src/cc/openhome/JNotePad.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/B/JNotePad5/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad5/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad5/src/cc/openhome/TextDAO.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface TextDAO {
4 | void create(String file);
5 | String read(String file);
6 | void save(String file, String text);
7 | }
8 |
--------------------------------------------------------------------------------
/samples/B/JNotePad6/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad6/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad6/src/cc/openhome/TextDAO.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface TextDAO {
4 | void create(String file);
5 | String read(String file);
6 | void save(String file, String text);
7 | }
8 |
--------------------------------------------------------------------------------
/samples/B/JNotePad7/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/B/JNotePad7/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/B/JNotePad7/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/JNotePad7/src/cc/openhome/JNotePad.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/B/JNotePad7/src/cc/openhome/TextDAO.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface TextDAO {
4 | void create(String file);
5 | String read(String file);
6 | void save(String file, String text);
7 | }
8 |
--------------------------------------------------------------------------------
/samples/CH02/Hello1/src/Some.java:
--------------------------------------------------------------------------------
1 | import cc.openhome.*;
2 | import java.util.*;
3 | public class Some {
4 | public static void main(String[] args) {
5 | cc.openhome.Arrays arrays;
6 | }
7 | }
--------------------------------------------------------------------------------
/samples/CH02/Hello1/src/cc/openhome/Arrays.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public class Arrays {
3 | }
--------------------------------------------------------------------------------
/samples/CH02/Hello1/src/cc/openhome/Main.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import cc.openhome.util.Console;
4 |
5 | public class Main {
6 | public static void main(String[] args) {
7 | Console.writeLine("Hello World");
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/samples/CH02/Hello1/src/cc/openhome/util/Console.java:
--------------------------------------------------------------------------------
1 | package cc.openhome.util;
2 |
3 | public class Console {
4 | public static void writeLine(String text) {
5 | System.out.println(text);
6 | }
7 | }
--------------------------------------------------------------------------------
/samples/CH02/Hello2/build/built-jar.properties:
--------------------------------------------------------------------------------
1 | #Thu, 06 Mar 2014 16:14:42 +0800
2 |
3 |
4 | C\:\\workspace\\Hello2=
5 |
--------------------------------------------------------------------------------
/samples/CH02/Hello2/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH02/Hello2/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/samples/CH02/Hello2/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH02/Hello2/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/samples/CH02/Hello2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH02/Hello2/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH02/Hello2/nbproject/private/config.properties
--------------------------------------------------------------------------------
/samples/CH02/Hello2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH02/Hello2/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/CH02/Hello2/src/cc/openhome/Main.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Main {
4 | public static void main(String[] args) {
5 | System.out.println("Hello World");
6 |
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH02/HelloWorld.java:
--------------------------------------------------------------------------------
1 | public class HelloWorld {
2 | public static void main(String[] args) {
3 | System.out.println("Hello World");
4 | }
5 | }
--------------------------------------------------------------------------------
/samples/CH02/Main.java:
--------------------------------------------------------------------------------
1 | public class Main {
2 | public static void main(String[] args) {
3 | Console.writeLine("Hello World");
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/NineNineTable.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class NineNineTable {
4 | public static void main(String[] args) {
5 | for(int j = 1; j < 10; j++) {
6 | for(int i = 2; i < 10; i++) {
7 | System.out.printf("%d*%d=%2d ",i, j, i * j);
8 | }
9 | System.out.println();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/NineNineTable2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class NineNineTable2 {
4 | public static void main(String[] args) {
5 | for (int i = 2, j = 1; j < 10; i = (i==9)?((++j/j)+1):(i+1)) {
6 | System.out.printf("%d*%d=%2d%c", i, j, i * j, (i==9 ? '\n' : ' '));
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/Odd.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Odd {
4 | public static void main(String[] args) {
5 | int input = 10;
6 | int remain = input % 2;
7 | if(remain == 1) { // 餘數為1就是奇數
8 | System.out.printf("%d 為奇數%n", input);
9 | }
10 | else {
11 | System.out.printf("%d 為偶數%n", input);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/OneToTen.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class OneToTen {
4 | public static void main(String[] args) {
5 | for(int i = 1; i <= 10; i++) {
6 | System.out.println(i);
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/RandomStop.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class RandomStop {
4 | public static void main(String[] args) {
5 | while(true) {
6 | int number = (int) (Math.random() * 10);
7 | System.out.println(number);
8 | if(number == 5) {
9 | break;
10 | }
11 | }
12 | System.out.println("I hit 5....Orz");
13 | }
14 | }
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/RandomStop2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class RandomStop2 {
4 | public static void main(String[] args) {
5 | int number;
6 | do {
7 | number = (int) (Math.random() * 10);
8 | System.out.println(number);
9 | } while(number != 5);
10 | System.out.println("I hit 5....Orz");
11 | }
12 | }
--------------------------------------------------------------------------------
/samples/CH03/Basic/src/cc/openhome/Shift.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shift {
4 | public static void main(String[] args) {
5 | int number = 1;
6 | System.out.printf( "2 的 0 次方: %d%n", number);
7 | System.out.printf( "2 的 1 次方: %d%n", number << 1);
8 | System.out.printf( "2 的 2 次方: %d%n", number << 2);
9 | System.out.printf( "2 的 3 次方: %d%n", number << 3);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH04/Array/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH04/Array/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH04/Array/src/cc/openhome/IrregularArray.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class IrregularArray {
4 | public static void main(String[] args) {
5 | int[][] arr = new int[2][];
6 | arr[0] = new int[] {1, 2, 3, 4, 5};
7 | arr[1] = new int[] {1, 2, 3};
8 | for(int[] row : arr) {
9 | for(int value : row) {
10 | System.out.printf("%2d", value);
11 | }
12 | System.out.println();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/samples/CH04/Array/src/cc/openhome/Scores.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Scores {
4 | public static void main(String[] args) {
5 | int[] scores = {88, 81, 74, 68, 78, 76, 77, 85, 95, 93};
6 | for(int i = 0; i < scores.length; i++) {
7 | System.out.printf("學生分數:%d %n", scores[i]);
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/CH04/Array/src/cc/openhome/Scores2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 |
5 | public class Scores2 {
6 | public static void main(String[] args) {
7 | int[] scores = new int[10];
8 | for(int score : scores) {
9 | System.out.printf("%2d", score);
10 | }
11 | System.out.println();
12 | Arrays.fill(scores, 60);
13 | for(int score : scores) {
14 | System.out.printf("%3d", score);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/samples/CH04/Array/src/cc/openhome/XY.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class XY {
4 | public static void main(String[] args) {
5 | int[][] cords = {
6 | {1, 2, 3},
7 | {4, 5, 6}
8 | };
9 | for(int x = 0; x < cords.length; x++) {
10 | for(int y = 0; y < cords[x].length; y++) {
11 | System.out.printf("%2d", cords[x][y]);
12 | }
13 | System.out.println();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/samples/CH04/ClassObject/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH04/ClassObject/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH04/ClassObject/nbproject/private/config.properties
--------------------------------------------------------------------------------
/samples/CH04/ClassObject/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH04/ClassObject/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/CH04/ClassObject/src/cc/openhome/DecimalDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class DecimalDemo {
6 | public static void main(String[] args) {
7 | BigDecimal operand1 = new BigDecimal("1.0");
8 | BigDecimal operand2 = new BigDecimal("0.8");
9 | BigDecimal result = operand1.subtract(operand2);
10 | System.out.println(result);
11 | }
12 | }
--------------------------------------------------------------------------------
/samples/CH04/String/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH04/String/nbproject/configs/Justin.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH04/String/nbproject/configs/Justin.properties
--------------------------------------------------------------------------------
/samples/CH04/String/nbproject/private/config.properties:
--------------------------------------------------------------------------------
1 | config=Justin
2 |
--------------------------------------------------------------------------------
/samples/CH04/String/nbproject/private/configs/Justin.properties:
--------------------------------------------------------------------------------
1 | application.args=1 2 3 4 5
2 |
--------------------------------------------------------------------------------
/samples/CH04/String/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH04/String/src/cc/openhome/Average.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Average {
4 | public static void main(String[] args) {
5 | long sum = 0;
6 | for(String arg : args) {
7 | sum += Long.parseLong(arg);
8 | }
9 | System.out.println("平均:" + (float) sum / args.length);
10 | }
11 | }
--------------------------------------------------------------------------------
/samples/CH04/String/src/cc/openhome/OneTo100.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class OneTo100 {
4 | public static void main(String[] args) {
5 | StringBuilder oneTo100 = new StringBuilder();
6 | for (int i = 1; i < 100; i++) {
7 | oneTo100.append(i).append('+');
8 | }
9 | System.out.println(oneTo100.append(100).toString());
10 | }
11 | }
--------------------------------------------------------------------------------
/samples/CH05/Class/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH05/Class/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH05/Class/src/cc/openhome/ImportStatic.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Scanner;
4 | import static java.lang.System.in;
5 | import static java.lang.System.out;
6 |
7 | public class ImportStatic {
8 | public static void main(String[] args) {
9 | Scanner console = new Scanner(in);
10 | out.print("請輸入姓名:");
11 | out.printf("%s 你好!%n", console.nextLine());
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH05/Class/src/cc/openhome/MathTool.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class MathTool {
4 | public static int sum(int... numbers) {
5 | int sum = 0;
6 | for(int number : numbers) {
7 | sum += number;
8 | }
9 | return sum;
10 | }
11 | }
--------------------------------------------------------------------------------
/samples/CH05/Class/src/cc/openhome/ObjectInitialBlock.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | class Other {
4 | {
5 | System.out.println("物件初始區塊");
6 | }
7 |
8 | Other() {
9 | System.out.println("Other() 建構式");
10 | }
11 |
12 | Other(int o) {
13 | this();
14 | System.out.println("Other(int o) 建構式");
15 | }
16 | }
17 |
18 | public class ObjectInitialBlock {
19 | public static void main(String[] args) {
20 | new Other(1);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/samples/CH05/Class/src/cc/openhome/OverloadBoxing.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | class Some {
4 | void someMethod(int i) {
5 | System.out.println("int 版本被呼叫");
6 | }
7 | void someMethod(Integer integer) {
8 | System.out.println("Integer 版本被呼叫");
9 | }
10 | }
11 |
12 | public class OverloadBoxing {
13 | public static void main(String[] args) {
14 | Some s = new Some();
15 | s.someMethod(1);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation1/src/cc/openhome/CashCard.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | class CashCard {
4 | String number;
5 | int balance;
6 | int bonus;
7 | CashCard(String number, int balance, int bonus) {
8 | this.number = number;
9 | this.balance = balance;
10 | this.bonus = bonus;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH05/Encapsulation3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH05/Public/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH05/Public/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Game1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Game1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Game1/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | public void fight() {
5 | System.out.println("魔法攻擊");
6 | }
7 |
8 | public void cure() {
9 | System.out.println("魔法治療");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH06/Game1/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | public void fight() {
5 | System.out.println("揮劍攻擊");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/samples/CH06/Game2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Game2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Game2/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | public void fight() {
5 | System.out.println("魔法攻擊");
6 | }
7 |
8 | public void cure() {
9 | System.out.println("魔法治療");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH06/Game2/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | public void fight() {
5 | System.out.println("揮劍攻擊");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/samples/CH06/Game3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Game3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Game3/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("魔法攻擊");
7 | }
8 |
9 | public void cure() {
10 | System.out.println("魔法治療");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH06/Game3/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("揮劍攻擊");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH06/Game4/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Game4/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Game4/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("魔法攻擊");
7 | }
8 |
9 | public void cure() {
10 | System.out.println("魔法治療");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH06/Game4/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("揮劍攻擊");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH06/Game5/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Game5/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Game5/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("魔法攻擊");
7 | }
8 |
9 | public void cure() {
10 | System.out.println("魔法治療");
11 | }
12 |
13 | public String toString() {
14 | return String.format("魔法師 (%s, %d, %d)", this.name,
15 | this.level, this.blood);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/samples/CH06/Game5/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("揮劍攻擊");
7 | }
8 |
9 | public String toString() {
10 | return String.format("劍士 (%s, %d, %d)", this.name,
11 | this.level, this.blood);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH06/Game6/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Game6/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH06/Game6/nbproject/private/config.properties
--------------------------------------------------------------------------------
/samples/CH06/Game6/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH06/Game6/src/cc/openhome/Magician.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Magician extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("魔法攻擊");
7 | }
8 |
9 | public void cure() {
10 | System.out.println("魔法治療");
11 | }
12 |
13 | @Override
14 | public String toString() {
15 | return "魔法師 " + super.toString();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/samples/CH06/Game6/src/cc/openhome/SwordsMan.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwordsMan extends Role {
4 | @Override
5 | public void fight() {
6 | System.out.println("揮劍攻擊");
7 | }
8 |
9 | @Override
10 | public String toString() {
11 | return "劍士 " + super.toString();
12 | }
13 |
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/samples/CH06/Inheritance/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH06/Inheritance/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH06/Inheritance/src/cc/openhome/ConsoleGame.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ConsoleGame extends GuessGame {
6 | private Scanner console = new Scanner(System.in);
7 |
8 | @Override
9 | public void print(String text) {
10 | System.out.print(text);
11 |
12 | }
13 |
14 | @Override
15 | public int nextInt() {
16 | return console.nextInt();
17 | }
18 | }
--------------------------------------------------------------------------------
/samples/CH06/Inheritance/src/cc/openhome/Guess.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Guess {
4 | public static void main(String[] args) {
5 | GuessGame game = new ConsoleGame();
6 | game.go();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH07/Enum/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH07/Enum/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH07/Enum/src/cc/openhome/Action.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public enum Action {
4 | STOP, RIGHT, LEFT, UP, DOWN
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/Interface/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH07/Interface/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH07/Interface/src/cc/openhome/Action.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Action {
4 | public static final int STOP = 0;
5 | public static final int RIGHT = 1;
6 | public static final int LEFT = 2;
7 | public static final int UP = 3;
8 | public static final int DOWN = 4;
9 | }
--------------------------------------------------------------------------------
/samples/CH07/Interface/src/cc/openhome/Client.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Client {
4 | public final String ip;
5 | public final String name;
6 | public Client(String ip, String name) {
7 | this.ip = ip;
8 | this.name = name;
9 | }
10 | }
--------------------------------------------------------------------------------
/samples/CH07/Interface/src/cc/openhome/ClientEvent.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ClientEvent {
4 | private Client client;
5 | public ClientEvent(Client client) {
6 | this.client = client;
7 | }
8 |
9 | public String getName() {
10 | return client.name;
11 | }
12 |
13 | public String getIp() {
14 | return client.ip;
15 | }
16 | }
--------------------------------------------------------------------------------
/samples/CH07/Interface/src/cc/openhome/ClientListener.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface ClientListener {
4 | void clientAdded(ClientEvent event); // 新增Client會呼叫這個方法
5 | void clientRemoved(ClientEvent event); // 移除Client會呼叫這個方法
6 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human implements Swimmer {
4 | private String name;
5 | public Human(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 |
12 | @Override
13 | public void swim() {
14 | System.out.printf("人類 %s 游泳%n", name);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine implements Swimmer {
4 | private String name;
5 |
6 | public Submarine(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("潛水艇 %s 潛行%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld1/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public abstract void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human implements Swimmer {
4 | private String name;
5 | public Human(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 |
12 | @Override
13 | public void swim() {
14 | System.out.printf("人類 %s 游泳%n", name);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Ocean.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Ocean {
4 | public static void main(String[] args) {
5 | doSwim(new Anemonefish("尼莫"));
6 | doSwim(new Shark("蘭尼"));
7 | doSwim(new Human("賈斯汀"));
8 | doSwim(new Submarine("黃色一號"));
9 | }
10 |
11 | static void doSwim(Swimmer swimmer) {
12 | swimmer.swim();
13 | }
14 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine implements Swimmer {
4 | private String name;
5 |
6 | public Submarine(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("潛水艇 %s 潛行%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld2/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public abstract void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Flyer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Flyer {
4 | public abstract void fly();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/FlyingFish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class FlyingFish extends Fish implements Flyer {
4 | public FlyingFish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.println("飛魚游泳");
11 | }
12 |
13 | @Override
14 | public void fly() {
15 | System.out.println("飛魚會飛");
16 | }
17 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human implements Swimmer {
4 | private String name;
5 | public Human(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 |
12 | @Override
13 | public void swim() {
14 | System.out.printf("人類 %s 游泳%n", name);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Ocean.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Ocean {
4 | public static void main(String[] args) {
5 | doSwim(new Anemonefish("尼莫"));
6 | doSwim(new Shark("蘭尼"));
7 | doSwim(new Human("賈斯汀"));
8 | doSwim(new Submarine("黃色一號"));
9 | doSwim(new Seaplane("空軍零號"));
10 | doSwim(new FlyingFish("甚平"));
11 | }
12 |
13 | static void doSwim(Swimmer swimmer) {
14 | swimmer.swim();
15 | }
16 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Seaplane.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Seaplane implements Swimmer, Flyer {
4 | private String name;
5 |
6 | public Seaplane(String name) {
7 | this.name = name;
8 | }
9 |
10 | @Override
11 | public void fly() {
12 | System.out.printf("海上飛機 %s 在飛%n", name);
13 | }
14 |
15 | @Override
16 | public void swim() {
17 | System.out.printf("海上飛機 %s 航行海面%n", name);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine implements Swimmer {
4 | private String name;
5 |
6 | public Submarine(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("潛水艇 %s 潛行%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld3/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public abstract void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Airplane.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Airplane implements Flyer {
4 | protected String name;
5 |
6 | public Airplane(String name) {
7 | this.name = name;
8 | }
9 |
10 | @Override
11 | public void fly() {
12 | System.out.printf("飛機 %s 在飛%n", name);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Anemonefish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Anemonefish extends Fish {
4 | public Anemonefish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("小丑魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Boat.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Boat implements Swimmer {
4 | protected String name;
5 |
6 | public Boat(String name) {
7 | this.name = name;
8 | }
9 |
10 | @Override
11 | public void swim() {
12 | System.out.printf("船在水面 %s 航行%n", name);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Diver.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Diver extends Swimmer {
4 | public abstract void dive();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Fish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public abstract class Fish implements Swimmer {
4 | protected String name;
5 | public Fish(String name) {
6 | this.name = name;
7 | }
8 | public String getName() {
9 | return name;
10 | }
11 | @Override
12 | public abstract void swim();
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Flyer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Flyer {
4 | public abstract void fly();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/FlyingFish.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class FlyingFish extends Fish implements Flyer {
4 | public FlyingFish(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.println("飛魚游泳");
11 | }
12 |
13 | @Override
14 | public void fly() {
15 | System.out.println("飛魚會飛");
16 | }
17 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Helicopter.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Helicopter extends Airplane {
4 | public Helicopter(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void fly() {
10 | System.out.printf("飛機 %s 在飛%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Human.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Human {
4 | protected String name;
5 |
6 | public Human(String name) {
7 | this.name = name;
8 | }
9 |
10 | public String getName() {
11 | return name;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Ocean.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Ocean {
4 | public static void main(String[] args) {
5 | doSwim(new Anemonefish("尼莫"));
6 | doSwim(new Shark("蘭尼"));
7 | doSwim(new SwimPlayer("賈斯汀"));
8 | doSwim(new Submarine("黃色一號"));
9 | doSwim(new Seaplane("空軍零號"));
10 | doSwim(new FlyingFish("甚平"));
11 | }
12 |
13 | static void doSwim(Swimmer swimmer) {
14 | swimmer.swim();
15 | }
16 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Piranha.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Piranha extends Fish {
4 | public Piranha(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("食人魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Seaplane.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Seaplane extends Airplane implements Swimmer {
4 | public Seaplane(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void fly() {
10 | System.out.print("海上");
11 | super.fly();
12 | }
13 |
14 | @Override
15 | public void swim() {
16 | System.out.printf("海上飛機 %s 航行海面%n", name);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Shark.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Shark extends Fish {
4 | public Shark(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("鯊魚 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Submarine.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Submarine extends Boat implements Diver {
4 | public Submarine(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void dive() {
10 | System.out.printf("潛水艇 %s 潛行%n", name);
11 | }
12 | }
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/SwimPlayer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SwimPlayer extends Human implements Swimmer {
4 | public SwimPlayer(String name) {
5 | super(name);
6 | }
7 |
8 | @Override
9 | public void swim() {
10 | System.out.printf("游泳選手 %s 游泳%n", name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH07/OceanWorld4/src/cc/openhome/Swimmer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Swimmer {
4 | public abstract void swim();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH08/TryCatch/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH08/TryCatch/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH08/TryCatchFinally/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH08/TryCatchFinally/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH08/TryCatchFinally/src/cc/openhome/FinallyDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public class FinallyDemo {
3 | public static void main(String[] args) {
4 | System.out.println(test(true));
5 | }
6 |
7 | static int test(boolean flag) {
8 | try {
9 | if(flag) {
10 | return 1;
11 | }
12 | } finally {
13 | System.out.println("finally...");
14 | }
15 | return 0;
16 | }
17 | }
--------------------------------------------------------------------------------
/samples/CH09/Collection/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH09/Collection/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH09/Collection/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | interface IntegerFunction {
4 | Integer apply(Integer i);
5 | }
6 |
7 |
8 | public class Demo {
9 | public static void main(String[] args) {
10 |
11 | IntegerFunction doubleFunction = i -> i * 2;
12 |
13 |
14 |
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/samples/CH09/Collection/src/cc/openhome/Sort.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 |
5 | public class Sort {
6 | public static void main(String[] args) {
7 | List numbers = Arrays.asList(10, 2, 3, 1, 9, 15, 4);
8 | Collections.sort(numbers);
9 | System.out.println(numbers);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH09/Collection/src/cc/openhome/Sort4.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 |
5 | public class Sort4 {
6 | public static void main(String[] args) {
7 | List words = Arrays.asList("B", "X", "A", "M", "F", "W", "O");
8 | Collections.sort(words);
9 | System.out.println(words);
10 | }
11 | }
--------------------------------------------------------------------------------
/samples/CH09/Collection/src/cc/openhome/Sort6.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 | import static java.util.Comparator.*;
5 |
6 | public class Sort6 {
7 | public static void main(String[] args) {
8 | List words = Arrays.asList(
9 | "B", "X", "A", "M", null ,"F", "W", "O", null);
10 | words.sort(nullsFirst(reverseOrder()));
11 | System.out.println(words);
12 | }
13 | }
--------------------------------------------------------------------------------
/samples/CH09/Map/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH09/Map/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH09/Map/nbproject/private/config.properties
--------------------------------------------------------------------------------
/samples/CH09/Map/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH09/Map/person.properties:
--------------------------------------------------------------------------------
1 | # \u4f7f\u7528\u8005\u540d\u7a31\u8207\u5bc6\u78bc
2 | cc.openhome.username=justin
3 | cc.openhome.password=123456
--------------------------------------------------------------------------------
/samples/CH09/Map/src/cc/openhome/LoadProperties.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 | import java.util.Properties;
5 |
6 | public class LoadProperties {
7 | public static void main(String[] args) throws IOException {
8 | Properties props = new Properties();
9 | props.load(new FileInputStream(args[0]));
10 | System.out.println(props.getProperty("cc.openhome.username"));
11 | System.out.println(props.getProperty("cc.openhome.password"));
12 | }
13 | }
--------------------------------------------------------------------------------
/samples/CH09/Map/src/cc/openhome/LoadSystemProps.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Properties;
4 |
5 | public class LoadSystemProps {
6 | public static void main(String[] args) {
7 | Properties props = System.getProperties();
8 | System.out.println(props.getProperty("username"));
9 | System.out.println(props.getProperty("password"));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH09/Map/src/cc/openhome/MapKeyValue3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 |
5 | public class MapKeyValue3 {
6 | public static void main(String[] args) {
7 | Map map = new TreeMap();
8 | map.put("one", "一");
9 | map.put("two", "二");
10 | map.put("three", "三");
11 | map.forEach(
12 | (key, value) -> System.out.printf("(鍵 %s, 值 %s)%n", key, value)
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/CH09/Map/src/cc/openhome/Messages2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 |
5 | public class Messages2 {
6 | public static void main(String[] args) {
7 | Map messages = new TreeMap<>();
8 | messages.put("Justin", "Hello!Justin的訊息!");
9 | messages.put("Monica", "給Monica的悄悄話!");
10 | messages.put("Irene", "Irene的可愛貓喵喵叫!");
11 | System.out.println(messages);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH09/Map/src/cc/openhome/Messages3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 |
5 | public class Messages3 {
6 | public static void main(String[] args) {
7 | Map messages = new TreeMap<>((s1, s2) -> -s1.compareTo(s2));
8 | messages.put("Justin", "Hello!Justin的訊息!");
9 | messages.put("Monica", "給Monica的悄悄話!");
10 | messages.put("Irene", "Irene的可愛貓喵喵叫!");
11 | System.out.println(messages);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/B1234:
--------------------------------------------------------------------------------
1 | B1234 Justin Z
--------------------------------------------------------------------------------
/samples/CH10/Stream/B5678:
--------------------------------------------------------------------------------
1 | B5678 Monica _
--------------------------------------------------------------------------------
/samples/CH10/Stream/B9876:
--------------------------------------------------------------------------------
1 | B9876 Irene X
--------------------------------------------------------------------------------
/samples/CH10/Stream/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/src/cc/openhome/CharUtil.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 |
5 | public class CharUtil {
6 | public static void dump(Reader src, Writer dest) throws IOException {
7 | try(Reader input = src; Writer output = dest) {
8 | char[] data = new char[1024];
9 | int length;
10 | while((length = input.read(data)) != -1) {
11 | output.write(data, 0, length);
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/src/cc/openhome/CharUtilDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 |
5 | public class CharUtilDemo {
6 | public static void main(String[] args) throws IOException {
7 | FileReader reader = new FileReader(args[0]);
8 | StringWriter writer = new StringWriter();
9 | CharUtil.dump(reader, writer);
10 | System.out.println(writer.toString());
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/src/cc/openhome/Copy.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 |
5 | public class Copy {
6 | public static void main(String[] args) throws IOException {
7 | IO.dump(
8 | new FileInputStream(args[0]),
9 | new FileOutputStream(args[1])
10 | );
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/src/cc/openhome/Download.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 | import java.net.URL;
5 |
6 | public class Download {
7 | public static void main(String[] args) throws IOException {
8 | URL url = new URL(args[0]);
9 | InputStream src = url.openStream();
10 | OutputStream dest = new FileOutputStream(args[1]);
11 | IO.dump(src, dest);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/src/cc/openhome/StandardIn.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 | import java.util.*;
5 |
6 | public class StandardIn {
7 | public static void main(String[] args) throws IOException {
8 | System.setIn(new FileInputStream(args[0]));
9 | try (Scanner file = new Scanner(System.in)) {
10 | while (file.hasNextLine()) {
11 | System.out.println(file.nextLine());
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/CH10/Stream/src/cc/openhome/StandardOut.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 |
5 | public class StandardOut {
6 | public static void main(String[] args) throws IOException {
7 | try (PrintStream file = new PrintStream(
8 | new FileOutputStream(args[0]))) {
9 | System.setOut(file);
10 | System.out.println("HelloWorld");
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH11/Concurrency/nbproject/private/config.properties
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/src/cc/openhome/DirectExecutor.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.concurrent.Executor;
4 |
5 | public class DirectExecutor implements Executor {
6 | public void execute(Runnable r) {
7 | r.run();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/src/cc/openhome/ProducerConsumerDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ProducerConsumerDemo {
4 | public static void main(String[] args) {
5 | Clerk clerk = new Clerk();
6 | new Thread(new Producer(clerk)).start();
7 | new Thread(new Consumer(clerk)).start();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/src/cc/openhome/ProducerConsumerDemo2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ProducerConsumerDemo2 {
4 | public static void main(String[] args) {
5 | Clerk2 clerk = new Clerk2();
6 | new Thread(new Producer2(clerk)).start();
7 | new Thread(new Consumer2(clerk)).start();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/src/cc/openhome/ProducerConsumerDemo3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.concurrent.*;
4 |
5 | public class ProducerConsumerDemo3 {
6 | public static void main(String[] args) {
7 | BlockingQueue queue = new ArrayBlockingQueue(1); // 容量為1
8 | new Thread(new Producer3(queue)).start();
9 | new Thread(new Consumer3(queue)).start();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH11/Concurrency/src/cc/openhome/ThreadPerTaskExecutor.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.concurrent.Executor;
4 |
5 | public class ThreadPerTaskExecutor implements Executor {
6 | public void execute(Runnable r) {
7 | new Thread(r).start();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH11/Thread/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH11/Thread/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH11/Thread/src/cc/openhome/DaemonDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class DaemonDemo {
4 |
5 | public static void main(String[] args) {
6 | Thread thread = new Thread(() -> {
7 | while (true) {
8 | System.out.println("Orz");
9 | }
10 | });
11 | // thread.setDaemon(true);
12 | thread.start();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH11/Thread/src/cc/openhome/ProducerConsumerDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ProducerConsumerDemo {
4 | public static void main(String[] args) {
5 | Clerk clerk = new Clerk();
6 | new Thread(new Producer(clerk)).start();
7 | new Thread(new Consumer(clerk)).start();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH11/Thread/src/cc/openhome/Tortoise.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Tortoise implements Runnable {
4 | private int totalStep;
5 | private int step;
6 |
7 | public Tortoise(int totalStep) {
8 | this.totalStep = totalStep;
9 | }
10 |
11 | @Override
12 | public void run() {
13 | while (step < totalStep) {
14 | step++;
15 | System.out.printf("烏龜跑了 %d 步...%n", step);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/CH11/Thread/src/cc/openhome/TortoiseHareRace2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class TortoiseHareRace2 {
4 | public static void main(String[] args) {
5 | Tortoise tortoise = new Tortoise(10);
6 | Hare hare = new Hare(10);
7 | Thread tortoiseThread = new Thread(tortoise);
8 | Thread hareThread = new Thread(hare);
9 | tortoiseThread.start();
10 | hareThread.start();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/workspace/Lambda/src/cc/openhome/Async.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/src/cc/openhome/LambdaDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 |
5 | public class LambdaDemo {
6 | public static void main(String[] args) {
7 | String[] names = {"Justin", "caterpillar", "Bush"};
8 | Arrays.sort(names, (name1, name2) -> name1.length() - name2.length());
9 | System.out.println(Arrays.toString(names));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/src/cc/openhome/StringDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 |
5 | public class StringDemo {
6 | public static void main(String[] args) {
7 | String[] names = {"Justin", "caterpillar", "Bush"};
8 | Arrays.sort(names, String::compareTo);
9 | System.out.println(Arrays.toString(names));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/src/cc/openhome/StringOrder.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class StringOrder {
4 | public static int byLength(String s1, String s2) {
5 | return s1.length() - s2.length();
6 | }
7 |
8 | public static int byLexicography(String s1, String s2) {
9 | return s1.compareTo(s2);
10 | }
11 |
12 | public static int byLexicographyIgnoreCase(String s1, String s2) {
13 | return s1.compareToIgnoreCase(s2);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/CH12/Lambda/src/cc/openhome/StringOrderDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 |
5 | public class StringOrderDemo {
6 | public static void main(String[] args) {
7 | String[] names = {"Justin", "caterpillar", "Bush"};
8 | Arrays.sort(names, StringOrder::byLength);
9 | System.out.println(Arrays.toString(names));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH13/DateCalendar/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH13/DateCalendar/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH13/DateCalendar/src/cc/openhome/CurrentTime.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.text.*;
4 | import java.util.*;
5 |
6 | public class CurrentTime {
7 | public static void main(String[] args) {
8 | DateFormat dateFormat = new SimpleDateFormat(
9 | args.length == 0 ? "EE-MM-dd-yyyy" : args[0]);
10 | System.out.println(dateFormat.format(new Date()));
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH13/DateCalendar/src/cc/openhome/DateDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.*;
4 | import static java.lang.System.*;
5 |
6 | public class DateDemo {
7 | public static void main(String[] args) {
8 | Date date1 = new Date(currentTimeMillis());
9 | Date date2 = new Date();
10 |
11 | out.println(date1.getTime());
12 | out.println(date2.getTime());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH13/DateCalendar/src/cc/openhome/MonthDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import static java.lang.System.out;
4 | import java.time.Month;
5 |
6 | public class MonthDemo {
7 | public static void main(String[] args) {
8 | for(Month month : Month.values()) {
9 | out.printf("original: %d\tvalue: %d\t%s%n",
10 | month.ordinal(), month.getValue(), month);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH14/NIO/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH14/NIO/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH14/NIO/src/cc/openhome/Test.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 | import java.net.URL;
5 | import java.nio.channels.Channels;
6 |
7 | public class Test {
8 | public static void main(String[] args) throws IOException {
9 | URL url = new URL("http://openhome.cc");
10 |
11 | NIOUtil.dump(Channels.newChannel(url.openStream()), new FileOutputStream("c:\\workspace\\index.html").getChannel());
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH14/NIO2/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH14/NIO2/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH14/NIO2/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/CH14/NIO2/src/cc/openhome/DirAll.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.IOException;
4 | import java.nio.file.*;
5 |
6 | public class DirAll {
7 | public static void main(String[] args) throws IOException {
8 | Files.walkFileTree(Paths.get(args[0]), new ConsoleFileVisitor());
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/CH14/NIO2/src/cc/openhome/Download.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.io.*;
4 | import java.net.URL;
5 | import java.nio.file.*;
6 | import static java.nio.file.StandardCopyOption.*;
7 |
8 | public class Download {
9 | public static void main(String[] args) throws IOException {
10 | URL url = new URL(args[0]);
11 | Files.copy(url.openStream(), Paths.get(args[1]), REPLACE_EXISTING);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH14/NIO2/src/cc/openhome/Roots.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import static java.lang.System.out;
4 | import java.nio.file.*;
5 |
6 | public class Roots {
7 | public static void main(String[] args) {
8 | Iterable dirs = FileSystems.getDefault().getRootDirectories();
9 | dirs.forEach(out::println);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH15/I18N/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH15/I18N/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH15/I18N/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/CH15/I18N/src/cc/openhome/Hello.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import static java.lang.System.out;
4 | import java.util.ResourceBundle;
5 |
6 | public class Hello {
7 | public static void main(String[] args) {
8 | ResourceBundle res = ResourceBundle.getBundle("messages");
9 | out.print(res.getString("cc.openhome.welcome") + "!");
10 | out.println(res.getString("cc.openhome.name") + "!");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH15/I18N/src/messages.properties:
--------------------------------------------------------------------------------
1 | cc.openhome.welcome=Hello
2 | cc.openhome.name=World
--------------------------------------------------------------------------------
/samples/CH15/I18N/src/messages_en_US.properties:
--------------------------------------------------------------------------------
1 | cc.openhome.welcome=Hi
2 | cc.openhome.name=Earth
3 |
--------------------------------------------------------------------------------
/samples/CH15/I18N/src/messages_zh_TW.properties:
--------------------------------------------------------------------------------
1 | cc.openhome.welcome=\u54c8\u56c9
2 | cc.openhome.name=\u4e16\u754c
3 |
--------------------------------------------------------------------------------
/samples/CH15/Logging/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH15/Logging/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH15/Logging/src/cc/openhome/LoggerDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.logging.*;
4 |
5 | public class LoggerDemo {
6 | public static void main(String[] args) {
7 | Logger logger = Logger.getLogger(LoggerDemo.class.getName());
8 | logger.log(Level.WARNING, "WARNING 訊息");
9 | logger.log(Level.INFO, "INFO 訊息");
10 | logger.log(Level.CONFIG, "CONFIG 訊息");
11 | logger.log(Level.FINE, "FINE 訊息");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH15/Regex/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH15/Regex/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH15/Regex/src/cc/openhome/ReplaceDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ReplaceDemo {
4 | public static void main(String[] args) {
5 | String[] regexs = {".*foo", ".*?foo", ".*+foo"};
6 | for(String regex : regexs) {
7 | System.out.println("xfooxxxxxxfoo".replaceAll(regex, "Orz"));
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/CH15/Regex/src/cc/openhome/SplitDemo2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SplitDemo2 {
4 | public static void main(String[] args) {
5 | for(String str : "Justin dog Monica doggie Irene".split("dog")) {
6 | System.out.println(str.trim());
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH15/Regex/src/cc/openhome/SplitDemo3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SplitDemo3 {
4 | public static void main(String[] args) {
5 | for(String str : "Justin dog Monica doggie Irene".split("\\bdog\\b")) {
6 | System.out.println(str.trim());
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/CH16/JDBCDemo/jdbc.properties:
--------------------------------------------------------------------------------
1 | cc.openhome.url=jdbc:mysql://localhost:3306/demo
2 | cc.openhome.user=root
3 | cc.openhome.password=openhome
4 | cc.openhome.poolmax=10
--------------------------------------------------------------------------------
/samples/CH16/JDBCDemo/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH16/JDBCDemo/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH17/ClassLoader/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH17/ClassLoader/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustinSDK/JavaSE8Tutorial/8f309bdda70833d87a603f0c81ccb3972943b539/samples/CH17/ClassLoader/nbproject/private/config.properties
--------------------------------------------------------------------------------
/samples/CH17/ClassLoader/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
7 |
--------------------------------------------------------------------------------
/samples/CH17/ClassLoader/src/cc/openhome/Some.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | class Some {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/ConsolePlayer.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class ConsolePlayer implements Player {
4 | @Override
5 | public void play(String video) {
6 | System.out.println("正在播放 " + video);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/Hello.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Hello {
4 | void hello(String name);
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/HelloSpeaker.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class HelloSpeaker implements Hello {
4 | public void hello(String name) {
5 | System.out.printf("哈囉, %s%n", name);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/Player.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Player {
4 | void play(String video);
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/ProxyDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public class ProxyDemo {
3 | public static void main(String[] args) {
4 | LoggingHandler loggingHandler = new LoggingHandler();
5 | Hello helloProxy = (Hello) loggingHandler.bind(new HelloSpeaker());
6 | helloProxy.hello("Justin");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/Some.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Some {
4 | static {
5 | System.out.println("載入 Some.class 檔案");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/samples/CH17/Reflection/src/cc/openhome/SomeDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import static java.lang.System.out;
4 |
5 | public class SomeDemo {
6 | public static void main(String[] args) {
7 | Some s;
8 | out.println("宣告 Some 參考名稱");
9 | s = new Some();
10 | out.println("生成 Some 實例");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Debug.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.RUNTIME)
7 | public @interface Debug {
8 | String name();
9 | String value();
10 | }
11 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Email.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.Target;
4 | import java.lang.annotation.ElementType;
5 |
6 | @Target(ElementType.TYPE_PARAMETER)
7 | public @interface Email {}
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Filter.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.*;
4 |
5 | @Retention(RetentionPolicy.RUNTIME)
6 | @Repeatable(Filters.class)
7 | public @interface Filter {
8 | String value();
9 | }
10 |
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @interface Filters {
13 | Filter[] value();
14 | }
15 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Ignore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public @interface Ignore {
12 | String value();
13 | }
14 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/MailBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package cc.openhome;
8 |
9 | /**
10 | *
11 | * @author Justin
12 | * @param
13 | */
14 | public class MailBox<@Email T> {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Other.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Other {
4 | @Debug(name = "caterpillar", value = "2014/5/14")
5 | public void doOther() {
6 |
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/SecurityFilter.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | @Filter("/admin")
4 | @Filter("/manager")
5 | public interface SecurityFilter {}
6 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Some.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | /**
8 | *
9 | * @author Justin
10 | */
11 | public class Some {
12 | @Deprecated
13 | public void doSome() {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test {}
3 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test10.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | import java.lang.annotation.Inherited;
3 | @Inherited
4 | public @interface Test10 {}
5 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test11.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.Target;
4 | import java.lang.annotation.ElementType;
5 |
6 | @Target({ElementType.TYPE_USE})
7 | public @interface Test11 {
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test2 {
3 | int timeout();
4 | }
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test3 {
3 | String[] args();
4 | }
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test4.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test4 {
3 | int timeout() default 0;
4 | }
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test5.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test5 {
3 | Class expected() default Default.class;
4 | class Default {}
5 | }
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test6.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test6 {
3 | String[] args() default {};
4 | }
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test7.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 | public @interface Test7 {
3 | String[] args() default {"arg1", "arg2"};
4 | }
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test8.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.Target;
4 | import java.lang.annotation.ElementType;
5 |
6 | @Target({ElementType.METHOD})
7 | public @interface Test8 {}
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Test9.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.lang.annotation.Documented;
4 |
5 | @Documented
6 | public @interface Test9 {}
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/TestClass.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public @interface TestClass {
4 | Class[] value();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH18/Annotation/src/cc/openhome/Util.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package cc.openhome;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | *
11 | * @author Justin
12 | */
13 | public class Util {
14 | public static void doSome(T... varargs) {
15 |
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/samples/CH18/Enum/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH18/Enum/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH18/Enum/src/cc/openhome/Action.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Action {
4 | public static final int STOP = 0;
5 | public static final int RIGHT = 1;
6 | public static final int LEFT = 2;
7 | public static final int UP = 3;
8 | public static final int DOWN = 4;
9 | }
--------------------------------------------------------------------------------
/samples/CH18/Enum/src/cc/openhome/Action2.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public enum Action2 {
4 | STOP, RIGHT, LEFT, UP, DOWN
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH18/Enum/src/cc/openhome/Command.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public interface Command {
4 | void execute();
5 | }
6 |
--------------------------------------------------------------------------------
/samples/CH18/Enum/src/cc/openhome/Game3.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Game3 {
4 | public static void play(Action3 action) {
5 | action.execute();
6 | }
7 |
8 | public static void main(String[] args) {
9 | Game3.play(Action3.RIGHT);
10 | Game3.play(Action3.DOWN);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH18/Enum/src/cc/openhome/GameDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class GameDemo {
4 | public static void main(String[] args) {
5 | Game.play(Action2.DOWN.ordinal());
6 | Game.play(Action2.RIGHT.ordinal());
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/CH18/Generics/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/samples/CH18/Generics/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Justin\\AppData\\Roaming\\NetBeans\\8.0\\build.properties
3 |
--------------------------------------------------------------------------------
/samples/CH18/Generics/src/cc/openhome/Basket.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Arrays;
4 | import java.util.Comparator;
5 |
6 | public class Basket {
7 | public T[] things;
8 |
9 | public Basket(T... things) {
10 | this.things = things;
11 | }
12 |
13 | public void sort(Comparator super T> comparator) {
14 | Arrays.sort(things, comparator);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/CH18/Generics/src/cc/openhome/Demo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | import java.util.Comparator;
4 |
5 | public class Demo {
6 | public static void main(String[] args) {
7 | Basket bananas = new Basket<>(
8 | new Banana(30, 200), new Banana(50, 300));
9 | bananas.sort((banana1, banana2) -> banana1.price - banana2.price);
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/CH18/Generics/src/cc/openhome/Node.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class Node {
4 | public T value;
5 | public Node next;
6 |
7 | public Node(T value, Node next) {
8 | this.value = value;
9 | this.next = next;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/CH18/Generics/src/cc/openhome/SortDemo.java:
--------------------------------------------------------------------------------
1 | package cc.openhome;
2 |
3 | public class SortDemo {
4 | public static void main(String[] args) {
5 | String[] strs = {"3", "2", "5", "1"};
6 | for(String s : Sort.sorted(strs)) {
7 | System.out.println(s);
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------