Zip Code Wilmington’s Workbook for Java by Kristofer Younger
Copyright © 2021 by Zip Code Wilmington. All Rights Reserved.
Cover Design: Janelle Bowman
Published in the U.S.A.
April 2021: First Edition
While the publisher and author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions in this work is at your own risk. If any code samples or other information this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
Zip Code Wilmington is a non-profit coding boot-camp in Delaware for people who wish to change their lives by becoming proficient at coding. Find out more about us at https://zipcodewilmington.com
This book’s aim is to provide you with exercises to assist in learning the most basic fundamentals of Java, the world’s most popular programming language. It comes from the preparation sessions we often give prospective Zip Code applicants on how to do well on the Zip Code application coding assessment. By completing these exercises, reading the companion Fundamentals of Java book and/or taking one of ZipCodeWilmington’s preparation sessions, someone who has never coded in any language before can use this as a place to start, to study and to get ready to take the ZipCodeWilmington admissions assessment. If you have almost any serious coding experience, this book is probably too elementary for you.
You may be aware that Zip Code doesn’t focus on Java per se, and that can leave you wondering why the first book we wrote was all about Java. Well…
Java is a fairly easy programming language to learn, and we’re going to use it in this book to describe the basic fundamentals of coding. Its form is modern and it is widely used. It can be used for many purposes, from web applications to back-end server processing. We’re going to use it for learning simple, programming-in-the-small, methods and concepts; but make no mistake - Java is world-class language capable of amazing things.
Java also has the advantage that one can learn to use it without a lot of setup on a computer. In fact, we recommend the use of jshell for running the Java examples you’ll find in this book. jshell is Java’s built-in interactive shell that lets you type Java code and see results immediately. You can run almost every code snippet in the book and see what the code does without needing to create full programs.
Finally, because in this book all we aim to teach you is "programming in the small", Java is great for that. Many of the examples here are significantly less that 20 lines in length. We want you to get better at looking at small blocks of code to see how they work. These smaller examples and concepts are a core building block as you become proficient in coding.
Zed A. Shaw is a popular author of several books where he describes learning a programming language The Hard Way. Zed suggests, and we at Zip Code agree with him whole-heartedly, that the best, most impactful, highest return for your investment when learning to code, is type the code using your own fingers [1]
That’s right. Whether you are a "visual learner", a "video learner", or someone who can read textbooks like novels (are there any more of these out there?), the best way to learn to code is to code and to code by typing out the code with your own fingers. This means you DO NOT do a lot of copy and paste of code blocks; you really put in the work, making your brain better wired to code by coding with your own typing of the code.
You’re here, reading this, because you’re thinking (or maybe you know) that you want to become a coder. It’s pretty straight-forward.
You may have heard a friend wistfully dream of making a career at writing. "Oh," they say, "I wish I had time to write a great novel, I want to be a writer someday".
So you can ask them: Did you write today? How many words? And the excuses flow: "Oh, I have to pick up the kids" "Ran out of time, I’m so busy at work." "I had to cut the grass" and so on. Well, I’m here to tell you that all the excuses in the world don’t stop a real writer from writing. They just sit down and do it. As often as they can, sometimes even when they can’t (or shouldn’t).
Coding, like writing, isn’t something you can do when all your other chores, obligations, and entertainments are done. If you’re serious about learning coding, you must make time for coding.
Watching hours of YouTube videos will not make you a coder.
Reading dozens of blog posts, Medium articles, and books will not make you a coder.
Following along with endless step-by-step tutorials will not make you a coder.
The only way you’re going to learn to code is by doing it. Trying to solve a problem. Making mistakes, fixing them, learning from what worked and what didn’t at the keyboard.
Many have heard my often-repeated admonition: If you coded today, you’re a coder. If not, you’re not a coder. It really is as simple as that.
I happen to be among those who feel anyone can learn to code. It’s a 21st century superpower. When you code, you can change the world. Being proficient at coding can be a life-changing skill that impacts your life, your family’s life and your future forever. Time and time again, I’ve seen that the ability to learn to code is evenly distributed across the population, but the opportunity to learn to code is not. So, we run Zip Code to give people a shot at learning a 21st century superpower, no matter where you come from.
And fortune favors the prepared. Some day, you may be working at a great company, making a decent living, working with professionals in a great technical job. Your friends may say "You are so lucky!"
And you will think: Nope. It wasn’t luck. You’ll know that truly. You got there by preparing yourself to get there, and by working to get there, working very hard. Ain’t no luck involved, just hard work. You make your own luck by working hard.
As many know, getting a spot in a Zip Code cohort is a hard thing to do. Many try but only a few manage it. I often get asked "what can I do to prepare to get into Zip Code?"
The best way is to start solving coding problems on sites like https://hackerrank.com - HackerRank (among others) has many programming assignments, from extremely simple to very advanced. You login, and just do exercise after exercise, relieving you of one of the hardest of coding frustrations, that of trying to figure out what to code. Solving programming assignments is a good way to start to cultivate a coding mindset. Such a mindset is based on your ability to pay very close attention to detail, a desire to continually learn, and being able to stay focused on problem solving even if it takes a lot of grit and dedication.
Spending even 20 minutes a day, making progress on a programming task can make all the difference. Day after day your skills will grow, and before long you’ll look back on the early things you did and be astonished as to how simple the assignments were. You may even experience embarrassment at remembering how hard these simple exercises seemed at the time you did them. (It’s okay, we’ve all felt it. It’s part of the gig.)
Working on code every day makes you a coder. And coding everyday will help with your ability to eventually score high enough on the Zip Code admissions assessment that you get asked to group and potentially final interviews. And then, well, then you get to learn Java or Python and work yourself to exhaustion doing so. Lots and lots more hours.
Why?
You do that hard work, you put in those hours, you create lots of great code, you’ll make your own luck, and someone will be impressed and they will offer you a job. And that is the point, right? A job, doing what you love, coding. Right? RIGHT?
You’re Welcome,
-Kristofer
Ready?
Okay, let’s go.
Here are a series of other resources to go on from this point. Dev.java is a really good one.
Some Java sites for you to explore:
If you’re looking for more of a professional code tool, use an IDE like vscode: https://code.visualstudio.com (Many people use this these days.)