myPlanets = new ArrayList<>();
6 |
7 | public static void main(String[] args)
8 | {
9 | add("Earth");
10 | add("Jupiter");
11 | add("Mars");
12 | add("Venus");
13 | add("Saturn");
14 | add("Mercury");
15 | add("Neptune");
16 | add("Uranus");
17 | add("Dagobah");
18 | add("Kobol");
19 |
20 | for (PlanetCollection orb : myPlanets)
21 | {
22 | orb.print();
23 | }
24 |
25 | }
26 |
27 | public static void add(String name)
28 | {
29 | PlanetCollection newPlanet = new PlanetCollection(name);
30 | myPlanets.add(newPlanet);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Chapter11/PlanetCollection.java:
--------------------------------------------------------------------------------
1 |
2 | public class PlanetCollection
3 | {
4 | // Instance Variable
5 | private String planetName;
6 |
7 | // constructor
8 | public PlanetCollection(String name)
9 | {
10 | setPlanetName(name);
11 | }
12 |
13 | // mutator
14 | public void setPlanetName(String name)
15 | {
16 | this.planetName = name;
17 | }
18 |
19 | // accessor
20 | public String getPlanetName()
21 | {
22 | return this.planetName;
23 | }
24 |
25 | public void print()
26 | {
27 | System.out.println(getPlanetName());
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/Chapter11/addtest.js:
--------------------------------------------------------------------------------
1 | var addtest = function()
2 | {
3 | print("Simple Test");
4 | print("This JavaScript program adds the numbers 300 and 19.");
5 | print("Addition results = " + (300 + 19));
6 | }
7 | addtest();
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Packt
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Mastering Java 11 - Second Edition
5 |
6 |
7 |
8 | This is the code repository for [Mastering Java 11 - Second Edition](https://www.packtpub.com/application-development/mastering-java-11-second-edition?utm_source=github&utm_medium=repository&utm_campaign=9781789137613 ), published by Packt.
9 |
10 | **Develop modular and secure Java applications using concurrency and advanced JDK libraries.**
11 |
12 | ## What is this book about?
13 | Java 11 is a long-term release and its new features add to the richness of the language. It emphasizes variable-type inference, performance improvements, along with simplified multithreading.
14 |
15 | This book covers the following exciting features:
16 | * Write modular Java applications
17 | * Migrate existing Java applications to modular ones
18 | * Understand how the default G1 garbage collector works
19 | * Leverage the possibilities provided by the newly introduced Java Shell
20 | * Performance test your application effectively with the JVM harness
21 |
22 |
23 | If you feel this book is for you, get your [copy](https://www.amazon.com/dp/1789137616) today!
24 |
25 |
27 |
28 | ## Instructions and Navigations
29 | All of the code is organized into folders. For example, Chapter02.
30 |
31 | **Note:**
32 | The code files present in Chapter06 and Chapter08 are just for representational purpose. They can neither be tested nor can they be validated.
33 |
34 | The code will look like the following:
35 | ```
36 | public default void fastWalk() {
37 | Scanner scanner = new Scanner(System.in);
38 | System.out.println("Enter desired pacing: ");
39 | ```
40 |
41 | **Following is what you need for this book:**
42 | Mastering Java 11 is for experienced Java developers with a solid understanding of the Java language and want to progress to an advanced level
43 |
44 | With the following software and hardware list you can run all code files present in the book (Chapter 1-17).
45 | ### Software and Hardware List
46 | | Chapter | Software required | Hardware required |
47 | | -------- | ------------------------------------ | ----------------------------------- |
48 | |1-17|Java SE Developer Kit 11 (JDK)|A system with 4GB RAM|
49 | |1-17|An Integrated Development Environment(IDE)|A system with 4GB RAM|
50 |
51 |
52 | We also provide a PDF file that has color images of the screenshots/diagrams used in this book. [Click here to download it](https://www.packtpub.com/sites/default/files/downloads/9781789137613_ColorImages.pdf).
53 |
54 | ### Related products
55 | * Java Projects - Second Edition [[Packt]](https://www.packtpub.com/application-development/java-projects-second-edition?utm_source=github&utm_medium=repository&utm_campaign=9781789131895 ) [[Amazon]](https://www.amazon.com/dp/B07G1B4R8B)
56 |
57 | * Design Patterns and Best Practices in Java [[Packt]](https://www.packtpub.com/application-development/design-patterns-and-best-practices-java?utm_source=github&utm_medium=repository&utm_campaign=9781786463593 ) [[Amazon]](https://www.amazon.com/dp/B01K7M4U1U)
58 |
59 | ## Get to Know the Author
60 | **Dr Edward Lavieri**
61 | is a veteran developer with a strong academic background. He has earned a doctorate in computer science from Colorado Technical University, an MS in management information systems (Bowie State University), an MS in education (Capella University), and an MS in operations management (University of Arkansas).
62 |
63 | He has been creating and teaching computer science courses since 2002. Edward retired from the US Navy as a Command Master Chief after 25 years of active service. As the founder and creative director of three19, a software design and development studio. Edward is constantly designing and developing software.
64 |
65 | This is Edward's 10th book.
66 |
67 | ## Other books by the authors
68 | [Mastering Java 9](https://www.packtpub.com/application-development/mastering-java-9?utm_source=github&utm_medium=repository&utm_campaign=9781786468734)
69 |
70 | [Learning AWS Lumberyard Game Development](https://www.packtpub.com/game-development/learning-aws-lumberyard-game-development?utm_source=github&utm_medium=repository&utm_campaign=9781786460868)
71 |
72 | ### Suggestions and Feedback
73 | [Click here](https://docs.google.com/forms/d/e/1FAIpQLSdy7dATC6QmEL81FIUuymZ0Wy9vH1jHkvpY57OiMeKGqib_Ow/viewform) if you have any feedback or suggestions.
74 |
75 |
76 | ### Download a free PDF
77 |
78 | If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
79 | https://packt.link/free-ebook/9781789137613
--------------------------------------------------------------------------------