2019 Steven Brown
All rights reserved. No portion of this book may be reproduced in any form without permission from the publisher, except as permitted by U.S. copyright law. For permissions contact:
Contents
Introduction
Hi, Im Steve.
Im here to teach you the fundamentals of Java. Or the basics of Java. One of those. Or both.
I should probably start the book with a little elevator speech on why it exists.
SICK OF TRYING TO EARN MONEY BOUNCING FROM JOB TO JOB? CLICK HERE TO LEARN HOW TO EARN $120,000 A MONTH FROM HOME!!!
Wait, thats not right.
Let me start over
In my experience, many books designed for absolute beginners spend maybe a chapter talking to you like a beginner, then start talking to you like youre someone with average intelligence all the sudden. They forget their audience. It becomes a normal textbook.
I think its frustrating. I want to be treated like the idiot I am, damn it.
I assure you that in this book, I will not forget that youre a fucking idiot like me.
The only real requirement is you can read. And if youre downloading an eBook and cant read then Im not sure what to tell you, friend.
What this book is
This is a fast, easy read that will guide you through the basics of Java; from variables, methods, and operators, to classes, objects, and packages. Dont know what those words mean? No problem.
My mastery of the English language (worthy of at least a B- grade in high school) will suck you in to a mystical world of Java programming.
The completely home-grown and organic code snippets will spell things out that English otherwise cant.
The fact that Im watching YouTube while writing this book will have no adverse effects whatsoever.
And I wrote all of it by myself, so you know the book is completely home grown and organic. And prone to starting a lot of sentences with and.
This books goal is for you, the air-headed reader with an interest in Java programming, to be able to close this book and say Hey, I know quite a bit more than I did when I started reading it. And it wasnt too bad!
What this book is NOT
Like with any healthy relationship, we should be honest with each other. Ill be honest with you right now and say what this book is not :
- A detailed guide on how to download, install, and configure Java.
I just dont think it fits the format or theme of this book, and I could not be less interested in writing about it. I do have a little blurb on this topic, but Im focusing on the Java language itself.
- A workbook chalk full of exercises for you to do.
Theres a lot of these to go around considering Java is over 24 years old. Ill focus on teaching you the concepts, you start dicking around in the code and exercising your mind.
- A comprehensive guide to Java that fully explores everything it has to offer in detail.
Yeah, thats gonna be a no from me dog. The more intricate parts of Java Im only going to lightly touch on. And others we simply wont get to. Thats the nature of a book for fucking idiots.
- Written by a Java guru that has decades of experience.
Ive been writing code in Java for about 6 years but Im just a person.
- Emotionally stable
This book will be unfair and lash out at you, making personal attacks at times. I apologize in advance.
- Likely going to make me any money.
But Im willing to accept this.
How should I read this book?
Its meant to be read like something you browse while youre taking a poop on the toilet, but you enjoy it so much you continue to read it after youre done. Yeah, like that.
Just read it top to bottom, left to right. No, I dont have any special goddamn sections with special logos or icons, or any expert opinions just read the book you shitter.
Buckle up
Get your towels ready, its about to go down. Were about to start Chapter One, and once we start, theres no turning back.
Unless you turn the page back. In which case, there absolutely is turning back.
Chapter 0: Software Cliff Notes
Just kidding, were starting at Chapter 0 because programming. Heres a quick summary of software in general to get you up to speed.
This is an operating system: Windows . It runs on a computer and talks to its individual parts, so we dont have to.
This is a programming language: C++ . It is used by humans to write programs that run on an operating system.
This is a program: Google Chrome . Its a web browser, written in a programming language, that runs on your operating system and lets you view websites on the internet.
This is the programming language we will use in this book: Java .
This is the powerhouse of the cell: the Mitochondria .
These are parentheses: ( )
These are curly braces: { }
These are square braces / brackets: [ ]
These are angle brackets: < >
This is a giraffe:
Wonderful, now that youre up to speed to the rest of the book!
Chapter 1: What the fuck is a Java?
Java is a programming language (the most popular one in the world, btw). A programming language is a special kind of language that computers can understand.
When you write things down in a programming language, what you create is often referred to as code . Not Morse code, or any sort of secret code you use to tell someone youre upset instead of just saying why youre upset. None of that; computer code.
A programmer therefore is someone that writes code, in a programming language, so that computers can do things for us.
However, computers are idiots, even more so than you are. If you show your Java code to your computer, it doesnt know how to read it. Hah! Stupid machine!
We do something called compilation to turn our programming language code into a format the computer will understand. Com pill ayy shin. The act of compiling. Like compiling a list of everything you want to order from the Chinese restaurant.
Now, when I saw we I dont mean that a human actually does this compilation thing. Only that we rely upon the compilation process to create our programs.
Let me give you an example:
- Steve writes some code for a program that can generate memes, automagically!
- A compiler turns his source code (what he wrote) into machine code .
- Steves computer runs that machine code so he can enjoy his fresh memes.
So, Steves source code (human readable) is compiled by a compiler to create machine code (machine readable). And the machine code is what runs on the computer.
Its like hiring a translator to speak to someone in a different language.
Source Code -> Compiler -> Machine Code
Computer, add 2 and 2 please -> Compiler -> 01100110101
Make sense?
You write source code, a compiler turns it into machine code, and the computer runs that machine code. Get it into your thicc skull (two cs).
Compiling interest
Now, there is a part I left out. You see, machine code is created specifically for the CPU of a computer.
At this point your eyes are probably about to roll into the back of your head. Either because you know what this is already, or youre already confused. Bear with me.