Learn Java with Projects A Concise Practical Guide to Learning Everything a Java Professional Really Needs to Know

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...

Descripción completa

Detalles Bibliográficos
Otros Autores: Kennedy, Sean, author (author), Putten, Maaike van, author
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, England : Packt Publishing Ltd [2023]
Edición:First edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009785404806719
Tabla de Contenidos:
  • Cover
  • Title Page
  • Copyright and Credits
  • Contributors
  • Table of Contents
  • Preface
  • Part 1: Java Fundamentals
  • Chapter 1: Getting Started with Java
  • Technical requirements
  • Exploring Java features
  • OOP in Java
  • Working with OOP
  • Compiled language
  • Write once, run anywhere
  • Automatic memory management
  • Installing Java
  • Checking whether Java is installed on your system
  • Installing Java on Windows
  • Installing Java on macOS
  • Installing Java on Linux
  • Running Java online
  • Writing our first program
  • Hello world
  • Steps to create the program
  • Understanding the program
  • Compiling and running Java programs
  • Understanding the compilation process
  • Compiling the code with javac on the command line
  • Running the compiled code with Java on the command line
  • Working with an IDE
  • What is an IDE?
  • Choosing an IDE
  • Creating and running a program with an IDE
  • Creating a program in an IDE
  • Running your program
  • Debugging a program
  • Exercises
  • Project
  • Summary
  • Chapter 2: Variables and Primitive Data Types
  • Technical requirements
  • Understanding and declaring variables
  • What is a variable?
  • Declaring a variable
  • Naming a variable
  • Accessing a variable
  • Accessing a variable that you have not declared
  • Understanding Java's primitive data types
  • Java's primitive data types
  • Screen output
  • Exercises
  • Project - dinosaur profile generator
  • Summary
  • Chapter 3: Operators and Casting
  • Technical requirements
  • Learning how Java's operators cooperate
  • Order of precedence
  • Associativity
  • Understanding Java's operators
  • Unary operators
  • Arithmetic operators
  • Relational operators
  • Logical operators
  • Bitwise operators
  • Ternary operator
  • Compound assignment operators
  • Explaining Java casting
  • Widening
  • Narrowing
  • Exercises.
  • Project - Dino meal planner
  • Summary
  • Chapter 4: Conditional Statements
  • Technical requirements
  • Understanding scope
  • What is a block?
  • Exploring if statements
  • The if statement itself
  • else if statements
  • else statements
  • Mastering switch statements and expressions
  • switch statements
  • switch expressions
  • Exercises
  • Project - Task allocation system
  • Summary
  • Chapter 5: Understanding Iteration
  • Technical requirements
  • while loops
  • do-while loops
  • while versus do-while
  • for loops
  • Traditional for loop
  • Enhanced for loop
  • Nested loops
  • break and continue statements
  • break statements
  • continue statements
  • Exercises
  • Project - Dino meal planner
  • Summary
  • Chapter 6: Working with Arrays
  • Technical requirements
  • Arrays - what, when, and why?
  • Arrays explained
  • When to use arrays
  • Declaring and initializing arrays
  • Declaring arrays
  • Initializing arrays
  • Short syntax for array initialization
  • Accessing elements in an array
  • Understanding indexing
  • Accessing array elements
  • Modifying array elements
  • Working with length and bounds
  • Determining the length of an array
  • Dealing with the bounds of an array
  • Iterating over arrays
  • Using the for loop
  • Using the for each loop
  • Choosing between the regular loop and the enhanced for loop
  • Handling multidimensional arrays
  • Declaring and initializing multidimensional arrays
  • Accessing and modifying elements of multidimensional arrays
  • Iterating over multidimensional arrays
  • Using Java's built-in methods for arrays
  • Built-in Arrays class for working with arrays
  • Exercises
  • Project - Dino tracker
  • Summary
  • Chapter 7: Methods
  • Technical requirements
  • Explaining why methods are important
  • Flow of control
  • Abstraction
  • Code duplication.
  • Understanding the difference between method definition and method execution
  • Method definition
  • Method execution
  • Exploring method overloading
  • Method signature
  • Overloading a method
  • Explaining varargs
  • Mastering call by value
  • Primitives versus references in memory
  • Exercises
  • Project - Mesozoic Eden assistant
  • Summary
  • Part 2: Object-Oriented Programming
  • Chapter 8: Classes, Objects, and Enums
  • Technical requirements
  • Understanding the differences between classes and objects
  • Classes
  • Objects
  • Getting familiar with the new keyword
  • Contrasting instance with class members
  • Instance members (methods/data)
  • Class members (methods/data)
  • Exploring the "this" reference
  • Associating an instance with the "this" reference
  • Shadowing or hiding an instance variable
  • Applying access modifiers
  • private
  • Package-private
  • protected
  • public
  • packages
  • Encapsulation
  • Achieving encapsulation
  • Mastering advanced encapsulation
  • Call By value revisited
  • The issue
  • The solution
  • Delving into the object life cycle
  • Garbage collection
  • Object life cycle example
  • Explaining the instanceof keyword
  • Understanding enums
  • Simple enums
  • Complex enums
  • Appreciating records
  • Record patterns
  • Exercises
  • Project - Mesozoic Eden park manager
  • Summary
  • Chapter 9: Inheritance and Polymorphism
  • Technical requirements
  • Understanding inheritance
  • Advantages of inheritance
  • Disadvantages of inheritance
  • Base class
  • Subclass
  • The "is-a" relationship
  • Applying inheritance
  • extends
  • implements
  • Exploring polymorphism
  • Separating the reference type from the object type
  • Applying polymorphism
  • JVM - object type versus reference type usage
  • Contrasting method overriding and method overloading
  • Method overloading
  • Method overriding
  • Exploring the super keyword.
  • super()
  • super.
  • An example of using super
  • Revisiting the protected access modifier
  • The UML diagram
  • The package with the protected member
  • The other package
  • Pattern matching for switch
  • Explaining the abstract and final keywords
  • The abstract keyword
  • The final keyword
  • Applying sealed classes
  • sealed and permits
  • non-sealed
  • Example using sealed, permits, and non-sealed
  • Understanding instance and static blocks
  • Instance blocks
  • static blocks
  • Mastering upcasting and downcasting
  • Upcasting
  • Downcasting
  • Exercises
  • Project
  • Summary
  • Chapter 10: Interfaces and Abstract Classes
  • Technical requirements
  • Understanding abstract classes
  • Mastering interfaces
  • Abstract methods in interfaces
  • Interface constants
  • Multiple interface inheritance
  • Examining default and static interface methods
  • 'default' interface methods
  • 'static' interface methods
  • Multiple interface inheritance
  • Explaining 'private' interface methods
  • Exploring sealed interfaces
  • Exercises
  • Project - unified park management system
  • Summary
  • Chapter 11: Dealing with Exceptions
  • Technical requirements
  • Understanding exceptions
  • What are exceptions?
  • Need for exception handling
  • Common situations that require exception handling
  • Understanding the exception hierarchy
  • Checked exceptions
  • Unchecked exceptions
  • Working with basic I/O operations
  • Reading from a file using FileReader
  • Writing to a file using FileWriter
  • Throwing exceptions
  • The throw keyword
  • Creating and throwing custom exceptions
  • The catch or declare principle
  • Understanding the principle
  • Declaring exceptions using throws
  • Handling exceptions with try-catch
  • Handling exceptions with try-with-resources
  • Working with inheritance and exceptions
  • Declaring exceptions in method signatures.
  • Overriding methods and exception handling
  • Exercises
  • Project - dinosaur care system
  • Summary
  • Chapter 12: Java Core API
  • Technical requirements
  • Understanding the Scanner class
  • Using Scanner to read from the keyboard
  • Using Scanner to read from a file
  • Using Scanner to read from a string
  • Comparing String with StringBuilder
  • String class
  • StringBuilder class
  • String versus StringBuilder example
  • Designing a custom immutable type
  • The checklist
  • Examining List and ArrayList
  • List properties
  • Exploring the Date API
  • Dates and times
  • Duration and Period
  • Additional interesting types
  • Formatting dates and times
  • Exercises
  • Project - dinosaur care system
  • Summary
  • Part 3: Advanced Topics
  • Chapter 13: Generics and Collections
  • Technical requirements
  • Getting to know collections
  • Overview of different collection types
  • List
  • ArrayList
  • LinkedList
  • Exploring the basic operations for lists
  • Set
  • HashSet
  • TreeSet
  • LinkedHashSet
  • Performing basic operations on a set
  • Map
  • HashMap
  • TreeMap
  • LinkedHashMap
  • Basic operations on maps
  • Queue
  • Queue implementations
  • Basic operations on the Queue interface
  • Sorting collections
  • Natural ordering
  • The Comparable and Comparator interfaces
  • Working with generics
  • Life before generics - objects
  • Use case of generics
  • Syntax generics
  • Bounded generics
  • Hashing and overriding hashCode()
  • Understanding basic hashing concepts
  • hashCode() and its role in collections
  • Overriding hashCode() and best practices
  • Using hashCode() in custom generic types
  • Exercises
  • Project - advanced dinosaur care system
  • Summary
  • Chapter 14: Lambda Expressions
  • Technical requirements
  • Understanding lambda expressions
  • Functional Interfaces
  • Lambda expressions
  • final or effectively final.
  • Exploring functional interfaces from the API.