Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Java with Projects

You're reading from   Learn Java with Projects A concise practical guide to learning everything a Java professional really needs to know

Arrow left icon
Product type Paperback
Published in Nov 2023
Publisher Packt
ISBN-13 9781837637188
Length 598 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Maaike van Putten Maaike van Putten
Author Profile Icon Maaike van Putten
Maaike van Putten
Dr. Seán Kennedy Dr. Seán Kennedy
Author Profile Icon Dr. Seán Kennedy
Dr. Seán Kennedy
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Part 1: Java Fundamentals
2. Chapter 1: Getting Started with Java FREE CHAPTER 3. Chapter 2: Variables and Primitive Data Types 4. Chapter 3: Operators and Casting 5. Chapter 4: Conditional Statements 6. Chapter 5: Understanding Iteration 7. Chapter 6: Working with Arrays 8. Chapter 7: Methods 9. Part 2: Object-Oriented Programming
10. Chapter 8: Classes, Objects, and Enums 11. Chapter 9: Inheritance and Polymorphism 12. Chapter 10: Interfaces and Abstract Classes 13. Chapter 11: Dealing with Exceptions 14. Chapter 12: Java Core API 15. Part 3: Advanced Topics
16. Chapter 13: Generics and Collections 17. Chapter 14: Lambda Expressions 18. Chapter 15: Streams – Fundamentals 19. Chapter 16: Streams: Advanced Concepts 20. Chapter 17: Concurrency 21. Index

What this book covers

Chapter 1, Getting Started with Java, starts by discussing the main Java features, such as OOP. How to install Java on various operating systems and how to write your first Java program with and without an IDE are also explored.

Chapter 2, Variables and Primitive Data Types, explains what a variable is and the fact that Java uses “strong-typing” (you must declare a variables type). This chapter also covers Java’s primitive data types, their sizes in bytes (needed to understand for later when discussing casting), and their ranges.

Chapter 3, Operators and Casting, explores how Java’s operators cooperate using precedence and associativity. We discuss Java’s various operators and explain both widening and narrowing when casting in Java.

Chapter 4, Conditional Statements, focuses on both scope and conditional statements. We initially examine Java’s use of block scope. We then explain the various forms of the if statement; and conclude the chapter with both switch statements and switch expressions.

Chapter 5, Understanding Iteration, discusses loops, including while, do-while, for, and enhanced for. This chapter also explores the break and continue statements.

Chapter 6, Working with Arrays, describes why one needs arrays. We show how to declare and initialize arrays of various primitive types, including using the shorthand syntax. We discuss how to loop through an array, processing each element. Multi-dimensional arrays are also covered; as is the Arrays class.

Chapter 7, Methods, discusses the importance of methods and the difference between the method definition and method execution. Method overloading is discussed and the varargs format is explained. Lastly, the important concept of call-by-value is explained.

Chapter 8, Classes, Objects, and Enums, is a significant OOP chapter and details the following: the difference between classes and objects; the this reference; access modifiers; basic and advanced encapsulation; the object life cycle; the instanceof keyword; enums and records.

Chapter 9, Inheritance and Polymorphism, explains inheritance and polymorphism. We detail what overriding means and discuss the super, protected, abstract, and final keywords. We also explore sealed classes and upcasting/downcasting.

Chapter 10, Interfaces and Abstract Classes, covers both abstract classes and interfaces. We explain static, default, and private interface methods and also sealed interfaces.

Chapter 11, Dealing with Exceptions, explains exceptions and their purpose. We explain the difference between checked and unchecked exceptions. We delve into throwing exceptions and how to create your own custom exceptions. The important catch or declare principle is discussed; as are the try-catch, try-catch-finally, and try-with-resources blocks.

Chapter 12, Java Core API, introduces important classes/interfaces from the API, such as Scanner. We compare and contrast String and StringBuilder and discuss how to create a custom immutable type. We example the List interface and its popular implementation ArrayList. Lastly, we explore the Date API.

Chapter 13, Generics and Collections, discusses the collections framework and its interfaces List, Set, Map, and Queue. We examine several implementations of each and basic operations. We explain sorting using both the Comparable and Comparator interfaces. We finish by examining generics and basic hashing concepts.

Chapter 14, Lambda Expressions, explains what lambda expressions are and their relationship to functional interfaces. Several functional interfaces from the API are examined. Lastly, method references and the role of context in understanding them are outlined.

Chapter 15, Streams: Fundamentals, is our first chapter on streams. In this chapter, we discuss what a stream pipeline is and what stream laziness means. We show different ways to create both finite and infinite streams. We examine the terminal operations that start off the streaming process - including reductions such as collect() which is very useful for extracting information out of a stream.

Chapter 16, Streams: Advanced Concepts, starts by examining intermediate operations such as filter(), map(), and sorted(). We explore the primitive streams followed by how to map from one stream to another, regardless of type. The Optional type is explained and we conclude with a discussion of parallel streams.

Chapter 17, Concurrency, starts by explaining what concurrency is. We examine working with threads and present issues with concurrent access. Mechanisms to resolve these issues are discussed; namely: atomic classes, synchronized blocks, and the Lock interface. Concurrent collections and the ExecutorService are explored next. We finish with a discussion on threading problems such as data races, deadlock, and livelock.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime