Learn Object-Oriented Java the Hard Way

 Learn Object-Oriented Java the Hard Way

Graham Mitchell

This book is for sale at This version was published on 2016-10-12

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do. ? 2015 - 2016 Graham Mitchell

Also By Graham Mitchell

Learn Java the Hard Way

Contents

Preface: Learning by Doing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i Introduction: Object-Oriented Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii Exercise 0: The Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Exercise 1: Working With Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Exercise 2: Creating Your Own Single Objects . . . . . . . . . . . . . . . . . . . . . . . . . 23 Exercise 3: Defining Objects in Separate Files . . . . . . . . . . . . . . . . . . . . . . . . . 26 Exercise 4: Fields in an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Exercise 5: Programming Paradigms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Exercise 6: Accessing Fields in Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Exercise 7: Encapsulation and Automated Testing . . . . . . . . . . . . . . . . . . . . . . . 42 Exercise 8: Failure to Encapsulate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Exercise 9: Private Fields and Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Exercise 10: Automated Testing with Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Exercise 11: Public vs Private vs Unspecified . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Exercise 12: Reviewing Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Buy the Full Book! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Preface: Learning by Doing

I have been teaching beginners how to code for the better part of two decades. More than 2,000 students have taken my classes and left knowing how to write simple programs that work. Some learned how to do only a little and others gained incredible skill over the course of just a few years.

I have plenty of students who are exceptional but most of my students are regular kids with no experience and no particular aptitude for programming. This book is written for regular people like them.

Most programming books and tutorials online are written by people with great natural ability and very little experience with real beginners. Their books often cover far too much material far too quickly and overestimate what true beginners can understand.

If you have a lot of experience or extremely high aptitude, you can learn to code from almost any source. I sometimes read comments like "I taught my 9-year-old daughter to code, and she made her first Android app six weeks later!" If you are the child prodigy, this book is not written for you.

I have also come to believe that there is no substitute for writing lots of small programs. So that's what you will do in this book. You will type in small programs and run them.

"The best way to learn is to do." ? P.R. Halmos

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download