Book Image

Learn Java with Projects

By : Dr. Seán Kennedy, Maaike van Putten
5 (3)
Book Image

Learn Java with Projects

5 (3)
By: Dr. Seán Kennedy, Maaike van Putten

Overview of this book

Learn Java with Projects stands out in the world of Java guides; while some books skim the surface and others get lost in too much detail, this one finds a nice middle ground. You’ll begin by exploring the fundamentals of Java, from its primitive data types through to loops and arrays. Next, you’ll move on to object-oriented programming (OOP), where you’ll get to grips with key topics such as classes, objects, encapsulation, inheritance, polymorphism, interfaces, and more. The chapters are designed in a way that focuses on topics that really matter in real-life work situations. No extra fluff here, so that you get more time to spend on the basics and form a solid foundation. As you make progress, you’ll learn advanced topics including generics, collections, lambda expressions, streams and concurrency. This book doesn't just talk about theory—it shows you how things work with little projects, which eventually add up to one big project that brings it all together. By the end of this Java book, you’ll have sound practical knowledge of Java and a helpful guide to walk you through the important parts of Java.
Table of Contents (22 chapters)
1
Part 1: Java Fundamentals
9
Part 2: Object-Oriented Programming
15
Part 3: Advanced Topics

Summary

We’ve just explored the importance of exception handling. We now know how it allows us to separate the code logic from the error handling logic. We delved into the two main types of exceptions: checked and unchecked. Checked exceptions are exceptions that require explicit handling, whereas unchecked exceptions are usually caused by programming errors and do not need to be explicitly caught or declared.

We discussed the catch or declare principle, which requires checked exceptions to be caught in a try-catch block or declared in a method’s signature. The try-catch block allows us to handle exceptions by executing alternative code when an exception occurs. We also learned about using multiple catch blocks to handle different types.

Next, we saw the finally block, which is executed regardless of whether an exception occurs. This block is useful for cleaning up resources and ensuring certain actions are always performed. This finally block is less common since...