reklama - zainteresowany?

Head First Java. 3rd Edition - Helion

Head First Java. 3rd Edition
ebook
Autor: Kathy Sierra, Bert Bates, Trisha Gee
ISBN: 9781491910740
stron: 754, Format: ebook
Data wydania: 2022-05-12
Księgarnia: Helion

Cena książki: 237,15 zł (poprzednio: 275,76 zł)
Oszczędzasz: 14% (-38,61 zł)

Dodaj do koszyka Head First Java. 3rd Edition

What will you learn from this book?

Head First Java is a complete learning experience in Java and object-oriented programming. With this book, you'll learn the Java language with a unique method that goes beyond how-to manuals and helps you become a great programmer. Through puzzles, mysteries, and soul-searching interviews with famous Java objects, you'll quickly get up to speed on Java's fundamentals and advanced topics including lambdas, streams, generics, threading, networking, and the dreaded desktop GUI. If you have experience with another programming language, Head First Java will engage your brain with more modern approaches to coding--the sleeker, faster, and easier to read, write, and maintain Java of today.

What's so special about this book?

If you've read a Head First book, you know what to expect--a visually rich format designed for the way your brain works. If you haven't, you're in for a treat. With Head First Java, you'll learn Java through a multisensory experience that engages your mind, rather than by means of a text-heavy approach that puts you to sleep.

Dodaj do koszyka Head First Java. 3rd Edition

 

Osoby które kupowały "Head First Java. 3rd Edition", wybierały także:

  • Windows Media Center. Domowe centrum rozrywki
  • Ruby on Rails. Ćwiczenia
  • DevOps w praktyce. Kurs video. Jenkins, Ansible, Terraform i Docker
  • Przywództwo w Å›wiecie VUCA. Jak być skutecznym liderem w niepewnym Å›rodowisku
  • Scrum. O zwinnym zarzÄ…dzaniu projektami. Wydanie II rozszerzone

Dodaj do koszyka Head First Java. 3rd Edition

Spis treści

Head First Java. 3rd Edition eBook -- spis treści

  • Other books in OReillys Head First series
  • Table of Contents (the real thing)
  • How to Use This Book: Intro
    • Who is this book for?
      • Who should probably back away from this book?
    • We know what youre thinking
    • And we know what your brain is thinking
    • Metacognition: thinking about thinking
    • Heres what WE did:
    • Heres what YOU can do to bend your brain into submission
    • What you need for this book:
    • Last-minute things you need to know:
    • Technical Reviewers for the 3rd Edition
    • Other people to acknowledge for the 3rd Edition
    • Technical Editors for the 2nd Edition
    • Other people to credit, for the 2nd Edition
    • Just when you thought there wouldnt be any more acknowledgments*
  • 1. Breaking the Surface: Dive In: A Quick Dip
    • The way Java works
    • What youll do in Java
    • A very brief history of Java
      • Speed and memory usage
    • Code structure in Java
      • What goes in a source file?
      • What goes in a class?
      • What goes in a method?
    • Anatomy of a class
    • Writing a class with a main()
    • What can you say in the main method?
    • Looping and looping and...
      • Simple boolean tests
      • Example of a while loop
    • Conditional branching
    • Coding a serious business application
    • Monday morning at Bobs Java-enabled house
    • Phrase-O-Matic
      • How it works
    • Exercise
      • Code Magnets
      • BE the Compiler
      • JavaCross
      • Mixed Messages
      • Pool Puzzle
    • Exercise Solutions
      • Sharpen your pencil
      • Code Magnets
      • BE the Compiler
      • Pool Puzzle
      • JavaCross
      • Mixed Messages
  • 2. A Trip to Objectville: Classes and Objects
    • Chair Wars
      • (or How Objects Can Change Your Life)
      • At Lauras desk
      • At Brads laptop at the cafe
        • Laura thought shed nailed it. She could almost feel the rolled steel of the Aeron beneath her...
        • But wait! Theres been a spec change.
      • Back at Lauras desk
      • At Brads laptop at the beach
        • Laura delivered just moments ahead of Brad
      • Back at Lauras desk
      • At Brads laptop on his lawn chair at the Telluride Bluegrass Festival
      • So, Brad the OO guy got the chair and desk, right?
      • What about the Amoeba rotate()?
      • The suspense is killing me. Who got the chair and desk?
      • When you design a class, think about the objects that will be created from that class type. Think about:
        • Things an object knows about itself are called
        • Things an object can do are called
    • Whats the difference between a class and an object?
      • A class is not an object (but its used to construct them)
    • Making your first object
    • Making and testing Movie objects
    • Quick! Get out of main!
      • The two uses of main:
      • The Guessing Game
    • Running the Guessing Game
    • Exercise
      • BE the Compiler
      • Code Magnets
      • Pool Puzzle
      • Who Am I?
    • Exercise Solutions
      • Code Magnets
      • BE the Compiler
      • Puzzle Solutions
        • Pool Puzzle
      • Who Am I?
  • 3. Know Your Variables: Primitives and References
    • Declaring a variable
    • Id like a double mocha, no, make it an int.
      • Primitive Types
    • You really dont want to spill that...
    • Back away from that keyword!
    • This table reserved
    • Controlling your Dog object
    • An object reference is just another variable value
    • Java Exposed
      • Life on the garbage-collectible heap
      • Life and death on the heap
    • An array is like a tray of cups
    • Arrays are objects too
    • Make an array of Dogs
    • Control your Dog (with a reference variable)
    • What happens if the Dog is in a Dog array?
    • A Dog example
    • Exercise
      • BE the Compiler
      • Code Magnets
      • Pool Puzzle
      • A Heap o Trouble
      • The case of the pilfered references
      • Five-Minute Mystery
    • Exercise Solutions
      • Sharpen your pencil
      • Code Magnets
      • BE the Compiler
      • Puzzle Solutions
        • Pool Puzzle
      • Five-Minute Mystery
      • A Heap o Trouble
  • 4. How Objects Behave: Methods Use Instance Variables
    • Remember: a class describes what an object knows and what an object does
      • Can every object of that type have different method behavior?
    • The size affects the bark
    • You can send things to a method
    • You can get things back from a method
    • You can send more than one thing to a method
      • Calling a two-parameter method and sending it two arguments
      • You can pass variables into a method, as long as the variable type matches the parameter type
    • Java is pass-by-value. That means pass-by-copy.
    • Reminder: Java cares about type!
    • Cool things you can do with parameters and return types
    • Encapsulation
      • Do it or risk humiliation and ridicule.
      • Hide the data
    • Java Exposed
    • Encapsulating the GoodDog class
    • How do objects in an array behave?
    • Declaring and initializing instance variables
    • The difference between instance and local variables
    • Comparing variables (primitives or references)
    • Exercise
      • BE the Compiler
      • Who Am I?
      • Mixed Messages
      • Pool Puzzle
      • Five-Minute Mystery
    • Exercise Solutions
      • Sharpen your pencil
      • BE the Compiler
      • Who Am I?
      • Puzzle Solutions
        • Pool Puzzle
      • Five-Minute Mystery
      • Mixed Messages
  • 5. Extra-Strength Methods: Writing A Program
    • Lets build a Battleship-style game: Sink a Startup
    • First, a high-level design
    • The Simple Startup Game a gentler introduction
    • Developing a Class
      • The three things well write for each class:
    • Writing the method implementations
    • Writing test code for the SimpleStartup class
      • Based on this prep code:
      • Heres what we should test:
    • Test code for the SimpleStartup class
    • The checkYourself() method
    • Just the new stuff
    • Final code for SimpleStartup and SimpleStartupTestDrive
    • Prep code for the SimpleStartupGame class Everything happens in main()
    • The games main() method
    • random() and getUserInput()
    • One last class: GameHelper
    • Lets play
    • Whats this? A bug ?
      • Gasp!
    • More about for loops
      • Regular (non-enhanced) for loops
    • Trips through a loop
      • Difference between for and while
    • The enhanced for loop
    • Casting primitives
    • Exercise
      • BE the JVM
      • Code Magnets
      • JavaCross
      • Mixed Messages
    • Exercise Solutions
      • Be the JVM
      • Code Magnets
      • Puzzle Solutions
      • JavaCross
      • Mixed Messages
  • 6. Using the Java Library: Get to Know the Java API
    • In our last chapter, we left you with the cliff-hanger: a bug
      • How its supposed to look
      • How the bug looks
    • So what happened?
    • How do we fix it?
    • Option one is too clunky
    • Option two is a little better, but still pretty clunky
    • Wake up and smell the library
    • Some things you can do with ArrayList
    • Java Exposed
    • Solution
      • Sharpen your pencil
    • Comparing ArrayList to a regular array
    • Lets fix the Startup code
    • New and improved Startup class
    • Lets build the REAL game: Sink a Startup
    • What needs to change?
    • Who does what in the StartupBust game (and when)
    • Prep code for the real StartupBust class
    • The final version of the Startup class
    • Super powerful Boolean expressions
    • Ready-Bake Code
    • Using the Library (the Java API)
    • You have to know the full name* of the class you want to use in your code.
    • How to discover the API
    • Browse a book
    • Use the HTML API docs
    • Using the class documentation
    • Exercise
      • Code Magnets
      • JavaCross
    • Exercise Solutions
      • Code Magnets
      • JavaCross
  • 7. Better Living in Objectville: Inheritance and Polymorphism
    • Chair Wars Revisited...
    • What about the Amoeba rotate()?
    • Understanding Inheritance
    • An inheritance example:
    • Lets design the inheritance tree for an Animal simulation program
    • Using inheritance to avoid duplicating code in subclasses
    • Do all animals eat the same way?
      • Which methods should we override?
    • Looking for more inheritance opportunities
    • Which method is called?
    • Designing an Inheritance Tree
    • Using IS-A and HAS-A
    • But wait! Theres more!
    • How do you know if youve got your inheritance right?
    • When designing with inheritance, are you using or abusing?
    • So what does all this inheritance really buy you?
    • Inheritance lets you guarantee that all classes grouped under a certain supertype have all the methods that the supertype has*
    • Keeping the contract: rules for overriding
    • Overloading a method
    • Exercise
      • Mixed Messages
      • BE the Compiler
    • Exercise Solutions
      • BE the Compiler
      • Mixed Messages
      • Pool Puzzle
  • 8. Serious Polymorphism: Interfaces and Abstract Classes
    • Did we forget about something when we designed this?
    • The compiler wont let you instantiate an abstract class
    • Abstract vs. Concrete
    • Abstract methods
    • You MUST implement all abstract methods
    • Polymorphism in action
    • Uh-oh, now we need to keep Cats, too
    • What about non-Animals? Why not make a class generic enough to take anything?
    • So whats in this ultra-super-megaclass Object?
    • Using polymorphic references of type Object has a price...
    • When a Dog wont act like a Dog
    • Objects dont bark
    • Get in touch with your inner Object
    • Polymorphism means many forms.
      • Casting an object reference back to its real type.
    • What if you need to change the contract?
    • Lets explore some design options for reusing some of our existing classes in a PetShop program
    • Interface to the rescue!
    • Making and implementing the Pet interface
    • Invoking the superclass version of a method
    • Exercise
      • Pool Puzzle
    • Exercise Solutions
      • Whats the Picture ?
      • Whats the Declaration?
      • Pool Puzzle
  • 9. Life and Death of an Object: Constructors and Garbage Collection
    • The Stack and the Heap: where things live
    • Methods are stacked
      • A stack scenario
    • What about local variables that are objects?
    • If local variables live on the stack, where do instance variables live?
    • The miracle of object creation
    • Construct a Duck
    • Initializing the state of a new Duck
    • Using the constructor to initialize important Duck state*
    • Make it easy to make a Duck
      • Be sure you have a no-arg constructor
    • Doesnt the compiler always make a no-arg constructor for you? No!
    • Nanoreview: four things to remember about constructors
    • Wait a minute...we never DID talk about superclasses and inheritance and how that all fits in with constructors
    • The role of superclass constructors in an objects life
    • Making a Hippo means making the Animal and Object parts too...
    • How do you invoke a superclass constructor?
    • Can the child exist before the parents?
    • Superclass constructors with arguments
    • Invoking one overloaded constructor from another
    • Now we know how an object is born, but how long does an object live?
    • What about reference variables?
    • Exercise
      • BE the Garbage Collector
      • Popular Objects
      • Five-Minute Mystery
    • Exercise Solutions
      • Be the Garbage Collector
      • Popular Objects
      • Five-Minute Mystery
  • 10. Numbers Matter: Numbers and Statics
    • MATH methods: as close as youll ever get to a global method
    • The difference between regular (non-static) and static methods
    • What it means to have a class with static methods
    • Static methods cant use non-static (instance) variables!
    • Static methods cant use non-static methods, either!
    • Static variable: value is the same for ALL instances of the class
      • Initializing a static variable
    • static final variables are constants
    • final isnt just for static variables...
    • Math methods
    • Wrapping a primitive
    • Java will Autobox primitives for you
    • Autoboxing works almost everywhere
    • But wait! Theres more! Wrappers have static utility methods too!
    • And now in reverse...turning a primitive number into a String
    • Number formatting
    • Formatting deconstructed...
    • The percent (%) says, insert argument here (and format it using these instructions)
    • The format String uses its own little language syntax
    • The format specifier
    • The only required specifier is for TYPE
    • What happens if I have more than one argument?
    • Just one more thing...static imports
    • Fireside Chats
    • Exercise
      • BE the compiler
      • True or False
    • Exercise Solution
      • Sharpen your pencil
      • BE the compiler
      • True or False
  • 11. Data Structures: Collections and Generics
    • Tracking song popularity on your jukebox
    • Your first job, sort the songs in alphabetical order
    • Great question! You spotted the diamond operator
    • Exploring the java.util API, List and Collections
    • In the Real-World there are lots of ways to sort
    • Natural Ordering, what Java means by alphabetical
    • But now you need Song objects, not just simple Strings
    • Changing the Jukebox code to use Songs instead of Strings
    • It wont compile!
    • The sort() method declaration
    • Generics means more type-safety
    • Learning generics
    • Using generic CLASSES
    • Using type parameters with ArrayList
    • Using generic METHODS
    • Heres where it gets weird...
    • Revisiting the sort() method
    • In generics, extends means extends or implements
    • Finally we know whats wrong...
      • The Song class needs to implement Comparable
    • The new, improved, comparable Song class
    • We can sort the list, but...
    • Using a custom Comparator
    • Updating the Jukebox to use a Comparator
    • Fill-in-the-blanks
    • But wait! Were sorting in two different ways!
    • Sorting using only Comparators
    • Just the code that matters
    • What do we REALLY need in order to sort?
    • Enter lambdas! Leveraging what the compiler can infer
    • Where did all that code go?
    • Some interfaces have only ONE method to implement
    • Updating the Jukebox code with lambdas
    • Reverse Engineer
    • Uh-oh. The sorting all works, but now we have duplicates...
    • We need a Set instead of a List
    • The Collection API (part of it)
    • Using a HashSet instead of ArrayList
    • What makes two objects equal?
    • How a HashSet checks for duplicates: hashCode() and equals()
    • The Song class with overridden hashCode() and equals()
    • If we want the set to stay sorted, weve got TreeSet
    • What you MUST know about TreeSet...
    • TreeSet elements MUST be comparable
    • Weve seen Lists and Sets, now well use a Map
    • Creating and filling collections
    • Convenience Factory Methods for Collections
    • Finally, back to generics
      • Using polymorphic arguments and generics
    • But will it work with List<Dog>?
    • What could happen if it were allowed...?
    • We can do this with wildcards
    • Using the methods generic type parameter
    • Exercise
      • BE the Compiler, advanced
    • Exercise Solution
      • Fill-in-the-blanks
      • Reverse Engineer lambdas exercise
      • Sorting with lambdas
      • TreeSet exercise
      • BE the Compiler solution
  • 12. Lambdas and Streams: What, Not How: Lambdas and Streams
    • Tell the computer WHAT you want
    • Fireside Chats
    • When for loops go wrong
      • Mixed Messages
    • Small errors in common code can be hard to spot
    • Building blocks of common operations
    • Introducing the Streams API
    • Getting started with Streams
    • Streams are like recipes: nothings going to happen until someone actually cooks them
    • Getting a result from a Stream
    • Stream operations are building blocks
    • Building blocks can be stacked and combined
    • Customizing the building blocks
    • Create complex pipelines block by block
    • Yes, because Streams are lazy
    • Terminal operations do all the work
    • Collecting to a List
    • Guidelines for working with streams
      • Correct! Stream operations dont change the original collection.
    • Exercise
      • Code Magnets
    • Hello Lambda, my (not so) old friend
      • Passing behavior around
        • Lambda expressions are objects, and you run them by calling their Single Abstract Method
    • The shape of lambda expressions
    • Anatomy of a lambda expression
    • Variety is the spice of life
      • A lambda might have more than one line
      • Single-line lambdas dont need ceremony
      • A lambda might not return anything
      • A lambda might have zero, one, or many parameters
    • How can I tell if a method takes a lambda?
    • Exercise
      • BE the Compiler, advanced
    • Spotting Functional Interfaces
    • Functional interfaces in the wild
    • Lous back!
    • Exercise
    • Ready-Bake Code
    • Lous Challenge #1: Find all the rock songs
    • Filter a stream to keep certain elements
    • Lets Rock!
    • Getting clever with filters
    • Lous Challenge #2: List all the genres
    • Mapping from one type to another
    • Removing duplicates
    • Only one of every genre
    • Just keep building!
    • Sometimes you dont even need a lambda expression
    • Collecting results in different ways
    • But wait, theres more!
      • Checking if something exists
      • Find a specific thing
      • Count the items
      • Well, some operations may return something, or may not return anything at all
    • Optional is a wrapper
      • Yes, but now we have a way to ask if we have a result
    • Dont forget to talk to the Optional wrapper
      • The Unexpected Coffee
      • Five-Minute Mystery
      • Pool Puzzle
      • Mixed Messages
      • Who Does What?
    • Exercise Solutions
      • Code Magnets
      • BE the Compiler
      • Sharpen your pencil
      • Five-Minute Mystery
      • Pool Puzzle
  • 13. Risky Behavior: Exception Handling
    • Lets make a Music Machine
      • The finished BeatBox looks something like this:
    • Well start with the basics
      • The JavaSound API
    • First we need a Sequencer
      • Somethings wrong!
    • What happens when a method you want to call (probably in a class you didnt write) is risky?
    • Methods in Java use exceptions to tell the calling code, Something Bad Happened. I failed.
    • The compiler needs to know that YOU know youre calling a risky method
    • An exception is an object... of type Exception
    • If its your code that catches the exception, then whose code throws it?
    • Flow control in try/catch blocks
    • Finally: for the things you want to do no matter what
    • Flow Control
    • Did we mention that a method can throw more than one exception?
      • Catching multiple exceptions
    • Exceptions are polymorphic
    • Multiple catch blocks must be ordered from smallest to biggest
    • You cant put bigger baskets above smaller baskets
    • When you dont want to handle an exception...
    • Ducking (by declaring) only delays the inevitable
    • Getting back to our music code...
      • Exception Rules
    • Code Kitchen
    • Making actual sound
    • Version 1: Your very first sound player app
    • Making a MidiEvent (song data)
    • MIDI message: the heart of a MidiEvent
      • Anatomy of a message
    • Change a message
    • Version 2: Using command-line args to experiment with sounds
      • Where were headed with the rest of the CodeKitchens
    • Exercise
      • True or False
      • Code Magnets
      • JavaCross
      • Sharpen your pencil
    • Exercise Solution
      • True or False
      • Code Magnets
      • JavaCross
  • 14. A Very Graphic Story: Getting Gui
    • It all starts with a window
      • Put widgets in the window
    • Your first GUI: a button on a frame
    • But nothing happens when I click it...
    • Getting a user event
    • Listeners, Sources, and Events
    • Getting back to graphics...
    • Make your own drawing widget
    • Fun things to do in paintComponent()
    • Behind every good Graphics reference is a Graphics2D object
    • Because lifes too short to paint the circle a solid color when theres a gradient blend waiting for you
    • We can get an event. We can paint graphics. But can we paint graphics when we get an event?
    • GUI layouts: putting more than one widget on a frame
    • Lets try it with TWO buttons
    • So now we need FOUR widgets
    • And we need to get TWO events
      • How do you get action events for two different buttons when each button needs to do something different?
    • Inner class to the rescue!
    • An inner class instance must be tied to an outer class instance*
    • How to make an instance of an inner class
      • Java Exposed
    • Lambdas to the rescue! (again)
    • ActionListener is a Functional Interface
    • Lambdas, clearer and more concise
    • Using an inner class for animation
    • Code Kitchen
    • Listening for a non-GUI event
    • An easier way to make messages/events
    • Version One: using the new static makeEvent() method
    • Version Two: registering and getting ControllerEvents
    • Version Three: drawing graphics in time with the music
    • Exercise
      • Who Am I?
      • BE the Compiler
      • Pool Puzzle
    • Exercise Solutions
      • Who am I?
      • BE the Compiler
      • Pool Puzzle
  • 15. Work on Your Swing: Using Swing
    • Swing components
      • Components can be nested
    • Layout Managers
    • How does the layout manager decide?
      • Different layout managers have different policies
    • The Big Three layout managers: border, flow, and box
    • Playing with Swing components
    • Code Kitchen
    • Making the BeatBox
    • Exercise
      • Which code goes with which layout?
      • Code Fragments
      • GUI-Cross
    • Exercise Solutions
      • Which code goes with which layout?
      • GUI-Cross
  • 16. Saving Objects (and Text): Serialization and File I/O
    • Capture the beat
    • Saving state
    • Writing a serialized object to a file
    • Data moves in streams from one place to another
    • What really happens to an object when its serialized?
    • But what exactly IS an objects state? What needs to be saved?
    • If you want your class to be serializable, implement Serializable
    • Deserialization: restoring an object
    • What happens during deserialization?
    • Saving and restoring the game characters
      • The GameCharacter class
    • Version ID: A big serialization gotcha
    • Using the serialVersionUID
    • Object Serialization
    • Writing a String to a Text File
    • Text file example: e-Flashcards
    • Quiz Card Builder (code outline)
    • The java.io.File class
    • Reading from a text file
    • Quiz Card Player (code outline)
    • Parsing with String split()
    • NIO.2 and the java.nio.file package
    • Path, Paths, and Files (messing with directories)
    • Finally, a closer look at finally
    • Remember, finally ALWAYS runs!!
    • Finally, a closer look at finally, cont.
    • There IS a better way!
    • The try-with-resources (TWR), statement
    • Autocloseable, the very small catch
    • Autocloseable, its everywhere you do I/O
    • Code Kitchen
    • Saving a BeatBox pattern
    • Restoring a BeatBox pattern
    • Can they be saved?
    • Exercise
      • True or False
      • Code Magnets
    • Exercise Solutions
      • True or False
      • Code Magnets
  • 17. Make a Connection: Networking and Threads
    • Real-time BeatBox chat
    • Connecting, sending, and receiving
    • 1. Connect
    • 2. Receive
      • Reading from the network with BufferedReader
    • 3. Send
      • Writing to the network with PrintWriter
    • Theres more than one way to make a connection
      • Using a Socket
    • The DailyAdviceClient
    • DailyAdviceClient code
    • Writing a simple server application
    • DailyAdviceServer code
    • Writing a Chat Client
    • The really, really simple Chat Server
    • Java has multiple threads but only one Thread class
    • What does it mean to have more than one call stack?
    • To create a new call stack you need a job to run
    • To make a job for your thread, implement the Runnable interface
    • How NOT to run the Runnable
    • How we used to launch a new thread
    • A better alternative: dont manage the Threads at all
    • Running one job
      • The three states of a new thread
    • The thread scheduler
      • How did we end up with different results?
    • Putting a thread to sleep
    • Using sleep to make our program more predictable
    • There are downsides to forcing the thread to sleep
    • Counting down until ready
    • Making and starting two threads (or more!)
    • Pooling Threads
    • Running multiple threads
    • What will happen?
    • Closing time at the thread pool
    • Um, yes. There IS a dark side. Multithreading can lead to concurrency issues.
    • Exercise
      • Who Am I?
    • New and improved SimpleChatClient
    • Exercise
      • Code Magnets
    • Exercise Solutions
      • Who Am I?
      • Code Magnets
      • Code Kitchen
  • 18. Dealing with Concurrency Issues: Race Conditions and Immutable Data
    • What could possibly go wrong?
    • The Ryan and Monica problem, in code
    • The Ryan and Monica example
    • We need to check the balance and spend the money as one atomic thing
    • Using an objects lock
    • Using synchronized methods
    • Its important to lock the correct object
    • The dreaded Lost Update problem
    • Lets run this code...
    • Make the increment() method atomic. Synchronize it!
    • Deadlock, a deadly side of synchronization
    • You dont always have to use synchronized
      • Atomic variables
    • Compare-and-swap with atomic variables
    • Ryan and Monica, going atomic
    • Writing a class for immutable data
    • Using immutable objects
    • Changing immutable data
    • More problems with shared data
    • Reading from a changing data structure causes an Exception
    • Use a thread-safe data structure
    • CopyOnWriteArrayList
    • Exercise
      • BE the JVM
        • Near-miss at the airlock
      • Five-Minute Mystery
    • Exercise Solution
      • BE the JVM
      • Five-Minute Mystery
  • A. Final Code Kitchen
    • Final BeatBox client program
    • Final BeatBox server program
  • B. The top ten-ish topics that didnt make it into the rest of the book...
    • #11 JShell (Java REPL)
      • Why do you care?
        • Starting the REPL
        • Run Java code without a class
        • More than just lines of code
        • Code suggestions
        • Commands
    • #10 Packages
      • Packages prevent class name conflicts
      • Preventing package name conflicts
        • To put your class in a package:
        • A note on directories
      • Compiling and running with packages
        • Compiling with the -d (directory) flag
        • Running your code
    • #9 Immutability in Strings and Wrappers
      • Why do you care that Strings are immutable?
        • How does this save memory?
        • Immutability makes reuse possible
        • What happens to unused Strings?
      • Why do you care that Wrappers are immutable?
    • #8 Access levels and access modifiers (who sees what)
    • #7 Varargs
      • Why do you care?
        • How can I tell if a method takes varargs?
        • Creating a method that takes varargs
        • Rules
    • #6 Annotations
      • Why do you care?
        • Where will you see annotations?
        • Annotations can have elements
        • What do they do?
    • #5 Lambdas and Maps
      • Why do you care?
        • Create a new value if there isnt one for the key
        • Update the value only if it already exists
        • Other methods
    • #4 Parallel Streams
      • Going parallel
      • OK now what?
      • Multithreading is taken care of
      • Do not use parallel everywhere!
    • #3 Enumerations (also called enumerated types or enums)
      • Whos in the band?
      • The old way to fake an enum:
        • An official enum
        • Your enum extends java.lang.Enum
        • Using if and switch with enums
    • #2 Local Variable Type Inference (var)
      • Type inference, NOT dynamic types
      • Someone has to read your code
      • Tip: Better with useful variable names
      • Tip: Variable will be the concrete type
      • Tip: Dont use var with the diamond operator
    • #1 Records
      • Why do you care?
        • A Java data class, before Java 16
        • What if there was a special syntax for data classes?
        • Using a record
        • Goodbye get
        • You can override constructors
        • You can override or add methods
        • Records are immutable
  • Index

Dodaj do koszyka Head First Java. 3rd Edition

Code, Publish & WebDesing by CATALIST.com.pl



(c) 2005-2024 CATALIST agencja interaktywna, znaki firmowe należą do wydawnictwa Helion S.A.