A Complete Java Basics Tutorial In 500 Words…
Holy crap, I can’t believe I’m writing this article.
If you are:
- A student (college or high school) who is confused as f**k in his AP Computer Science class
- A beginner to learning Java programming
- Someone looking to learn Android app development
- Someone interested in learning Java basics (never coded before)
Then this article is for you.
My name is Ben and I’ve been doing Android app development and Java programming on and off for about 2 years.
I am by no means an expert.
I’m just a dumb 18 year-old kid that can code proficiently enough to try to help others with learning how to program Java.
I see so many people unnecessarily confused by Java in general and it can be helped…
…it can be difficult at first, as it was for me, but if you stick with it I guarantee reading and writing Java eventually will just be like speaking English (or whatever your native language) for you.
This overview will not be extremely in detail…it will be a simple story for you to get a better picture of java programming in a very broad sense
There is no need to learn java the hard way because if you are wondering how to learn java programming I’ll give my solution at the end of this article.
Anyway, here are the topics I will glaze over in my story.
Topics I’ll intertwine in my analogy:
- Architecture (Driver class vs. Regular class)
- Class —- state and behavior
- Control Flow (If, While, For, etc…)
500 words start….NOW:
Welcome the Smith’s residence.
Mr. Smith (let’s call him Smith from now on) is a happy man and a very cool object.
Like all Java objects he has 2 things
- He can be sad, happy, sick, healthy, etc.
- These are represented by class variables that store values and can change or be static
- He can pick things up, he can talk, he can do any general task
- These are represented by methods that can do anything you’d like them to do
Smith lives on planet Earth which can be considered a driver class.
Earth is where all actions and manifestations of life unfold in a debatably “scripted” way.
But despite Earth being the driver class where Smith’s life unfolds, Smith is still made up of his own class that is separate from Earth’s script.
A class is a blueprint for a Java object which is what Smith is!
Smith was created on Earth, just as objects are created as objects in driver classes where they can be used and their state and behavior can be manipulated.
But wait…people aren’t completely unchanging creatures…they don’t have any static variables (class variables that don’t change)
They have can dynamic variables that change:
- Outlook On Life
- Grades In School
- Language Proficiency
- And much more…
Let’s recap what we have so far…
Smith is an object with state and behavior like all java objects have. He was instantiated in our driver class Earth where he can do his thing and his class variables can be manipulated by what he comes in contact with or what happens to him on Earth (the driver class)
But wait…Smith needs parents.
Smith’s mom Suzy and his dad Carl had him as a baby and he got their traits through inheritance and Suzy and Carl are his parent classes.
(As you can picture by now, this is the basic framework of java, you make objects and children objects if you’d like. The children can inherit characteristics from their parent classes and even develop traits of their own!)
When Smith was young he really hated learning on his own…he knew there was a better way to solve problems that other people have already solved.
So he took a stroll and checked out some Java libraries.
What he found amazed him…people already had code to solve his problems and had written it down for him to use in his life (the program)
These libraries took the work off his shoulders and were open source meaning that anyone could use the code for free!
But It was getting late for Smith….
IF he were to go home now WHILE it was this dark it might not be safe…he would wait FOR the morning.
Programs always have to make decisions and reserved words like if, while, and for act as control flow statements to determine how a program (Smith’s life) will unfold.
They control the flow of logic in a program, hence control flow terms.
And that’s all folks.
You Just Learned The Basics Of Java Programming In 500 Words…
Good on you mate! (I never talk like this in real life…)
Despite this being a grossly oversimplified representation of coding for Java, it is actually pretty thorough in regards to conceptualization.
Here’s the thing…
…as a beginner to learning to program java online, you don’t need the specifics yet.
You can learn how to manage multi-threading operations and mitigate memory leaks another day
I remember when I knew nothing about how to code android apps and I though Java was what people drink in the morning to get their caffeine…
…all jokes aside, what you just read is literally the bread and butter of Java:
Make objects, manipulate their state and behavior, and do it in the most efficient way possible to solve a problem and get the task done.
It can be really confusing to learn initially, but what I think the best way to learn java programming is, is to learn java online.
Java books generally suck to read and follow because you are coding on the computer, not in the book.
Also, when you learn java online you can learn 2x or 3x as fast by speeding up videos.
One place I really loved to learn was TeamTreehouse.com.
After months of searching around, I learned java basics in 1 month and made my first independent android app in 1-2 months.
They offer thousands of videos and have awesome instructors that literally answer their own students all the time (each course has thousands of students…)
They really care about programming and helping other people succeed at learning a skill that could change their life for the better.
I actually give a full Team Treehouse Review and give you a full tour of the 2017 paid subscription member’s area in one of my articles
I was reluctant at first but when I say that they had a free trial where you get full access for nothing I hopped right in.
Long story short…I never looked back and now I have the skills to potentially land me a job someday if I choose to pursue development as a career.
If you can’t even try a free subscription then I don’t know how you’ll have the will power to literally learn a whole coding language.
So don’t wait any longer (I sound so marketer-ish right now…ugh) because I remember how I waited months for the right way to learn
Team Treehouse is the best way to learn java programming as a beginner and intermediate coder ever.
Team Treehouse boasts that you can get a job in 3 months with your programming language learning with them and I think that’s semi-true.
With insane work it’d be around that, but for the average person I’d put it at more like 4-6 months of learning since coding is very in-depth.
Anyway, click on of those links above if you’re interested in learning to program java or any language with TreeHouse…
…I promise you won’t be disappointed in it.
Next Post >>>