Java: How to start when you don't know where to start
Starting out learning a new programming language, especially when you have no previous experience with programming can be very daunting. There are daunting technological terms that make everything so complicated, the jump from no knowledge to your first program can seem insurmountable. However, never fear! This post will walk you through the basics to get you through your first program!.
First: The Program
I'll be honest, we really need two programs.
Here is why:
Computers don't speak human, and humans... well we don't speak in 0s and 1s.
Now, we could spend a lot of time learning how to speak in 10010101, but that just seems like work. So let's make it easier. Over the years, developers have created several languages to help humans efficiently translate human to computer. The language we will be using is called Java. The first program we need is Java language. This program is easy to download.
The second program is used to help us efficiently write code. This second program is called an IDE. You can just use Notepad to write out a program, but an IDE doesn't just LET you write a program, it HELPS you write a program. What I mean by that is that it color codes the program to help in differentiating the type of code, it can provide autocorrect for finishing long sets of commonly used code, and if set up properly, it can convert the code to 0's and 1's and then direct the computer to run it so you test it and make sure it works the way you intended.
Now, there are a lot of different IDE but a great place for a new programmer to start is with NetBeans. This IDE was specifically designed to work with Java.
This link will walk you through downloading both programs and get you started on your first program.
Second: The Code
Now the specifics of the code used in Java can be found in various tutorials online, like here.
What we are going to go over is some general concepts to help you understand how Java works.
The basic building block of Java is an object. An object is just a thing that has identifiable attributes.
In the physical world, things look like this:
In this picture each object is unique. We can see their color, size, and shape. These attributes are also shared by other objects like them. Take the baseball mitt in the picture. It is on the smaller end of sizing, it is a light brown color, and it has four separate fingers and black lacing. These are attributes that all baseball mitts share.
This is the same in object-oriented programming.
There are objects with attributes, and the template that houses the basic attributes and blueprint to build an object is called a class. In the picture above, the class is the template of all baseball mitts from which that particular baseball mitt was created.
Inside each class are the methods. These are what the object does. In the baseball mitt, there would be a method for opening and closing the mitt, for putting a hand inside it, and so on.
From there we could go on about encapsulation, abstraction, inheritance and polymorphism, but if you are as new to Java as I am, I bet your eyes just glazed over. So I will leave this here for now. If you want to learn more about those, here is a great place to learn more about Java.
If you find other great places to learn more about Java, post them below for others to use as well.
These basics will get you started with Java. Come back for more and Good Luck on your Java Journey!
Comments
Post a Comment