Learn Object-Oriented Java the Hard Way
Learn Object-Oriented Java the Hard Way
About the Book
“Learn Object-Oriented Java the Hard Way” focuses on the object-oriented parts of Java and covers them deeply, with plenty of complete working examples and the explanations you won’t find in other books.
You need some experience Java or a similar language before you will be able to make it through this material. If you have never programmed before in any language, you should start with my intro book “Learn Java the Hard Way”. But if you already know the basics of Java or another language like C, C++, C# or Javascript, this book is for you. And if you only know a very different language like Python or Ruby then you will have some catching up to do but will probably still be fine.
In the final chapter you’ll write a graphical version of a popular checker-dropping game and know how to package it up in a JAR file to send to others.
You will learn:
- How to install the Java compiler and a text editor
- How to work with Java objects and create your own classes
- Fields and instance variables
- Methods and Parameters
- Constructors
- Reference Variables vs Primitives
- Generics and Casting
- Inheritance
- Interfaces
- Abstract Classes and Methods
- Packages
- How to create JAR files
- Graphical User Interfaces in JavaFX
- Mouse and Keyboard Input in GUIs
- Testing and Efficiency
- Algorithmic Complexity and Big-O Notation
- ArrayLists
- Sorting
...and more!
Table of Contents
-
- Acknowledgements
- Preface: Learning by Doing
- Introduction: Object-Oriented Java
- Exercise 0: The Setup
- Exercise 1: Working With Objects
- Exercise 2: Creating Your Own Single Objects
- Exercise 3: Defining Objects in Separate Files
- Exercise 4: Fields in an Object
- Exercise 5: Programming Paradigms
- Exercise 6: Accessing Fields in Methods
- Exercise 7: Encapsulation and Automated Testing
- Exercise 8: Failure to Encapsulate
- Exercise 9: Private Fields and Constructors
- Exercise 10: Automated Testing with Arrays
- Exercise 11: Public vs Private vs Unspecified
- Exercise 12: Reviewing Constructors
- Exercise 13: Default Values for Fields
- Exercise 14: toString and this
- Exercise 15: Noughts and Crosses / Extreme Testing
- Exercise 16: Introduction to ArrayLists
- Exercise 17: Word Counter Using an ArrayList
- Exercise 18: Primitive Variables in Memory
- Exercise 19: Reference Variables in Memory
- Exercise 20: Lists of Primitive Values
- Exercise 21: Generics vs. Casts
- Exercise 22: Object-Oriented Design and Efficiency
- Exercise 23: Writing a Silly Class with Generics
- Exercise 24: Writing a Useful Class with Generics
- Exercise 25: Sorting and Complexity
- Exercise 26: Sorting Speeds - Primitives vs Objects
- Exercise 27: Static Variables and Static Methods
- Exercise 28: Popular Static Methods in Java
- Exercise 29: Importing Static Class Members
- Exercise 30: References as Parameters
- Exercise 31: Java Strings Are Immutable
- Exercise 32: Parameters vs Properties
- Exercise 33: Basic Inheritance
- Exercise 34: How Fields Are Inherited
- Exercise 35: “Useful” Inheritance - A Game Board
- Exercise 36: A Game Called Breakthrough
- Exercise 37: Two Kinds of Equality
- Exercise 38: Implementing Interfaces
- Exercise 39: The Comparable Interface
- Exercise 40: List and Map
- Exercise 41: Implementing Several Interfaces
- Exercise 42: DropGame and Assertions
- Exercise 43: Abstract Classes and Final Methods
- Exercise 44: Packages
- Exercise 45: Creating a JAR File
- Exercise 46: A Simple Graphical Window
- Exercise 47: An Interactive Window
- Exercise 48: Using (F)XML to Define Your Interface
- Exercise 49: Canvas Basics
- Exercise 50: Getting Mouse Input
- Exercise 51: More Complex Mouse Interaction
- Exercise 52: Animation
- Exercise 53: Handling Keypress Events
- Exercise 54: Graphical Noughts and Crosses
- Exercise 55: Graphical Drop Game
- Next Steps
- Notes
Other books by this author
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them