There are plenty of people I know who’d like to know how to program, yet they’re confused by how to start and what the general ideas of programming are. In addition, there are a large number of programming languages to choose from, so choosing the right one to start out with may be a little difficult for the inexperienced programmer. This article will help you get started with a relatively easy to learn language.
Why Learn Java Programming?
Java is my programming language of choice when trying to learn the concepts of programming. This is because Java is very cross-platform, has a fairly readable syntax (compared to other languages), and there are many tools that can make developing in Java a fairly easy task. Before we begin, make sure that you have the JDK installed, as you won’t be able to do a thing without it.
Parts Of Java
Java programs are separated into classes. Technically each class is its own program, but you can work with numerous classes to make a larger, more complex program while maintaining good code organization. At least one of those classes needs to be the main class, or contain a main method. A method is a chunk of code that executes when you simply call the name of the method. The main method is required as Java looks for this method to start the program. You can pass parameters to other methods if you’d like, allowing the method to take input and do something with it.
Variables
More than likely you’ll also need to store information at certain points. These are variables, or sometimes called fields, that hold the information. You have to specify the type of variable so that Java knows what you’re trying to hold. This includes things like true/false (boolean), numbers (int, long, double, etc.), and much more. As Java can support object-oriented programming, you can even hold instances of a class in a variable.
Example
As an example, here is a class that would simply print out the number 6 onto the screen:
public class makeuseof
{
public static void main (String args[])
{
int myNum = 6;
System.out.println(myNum);
}
}
2 Recommended Applications
There are two applications I would recommend that will help you during your programming adventures.
Greenfoot
Greenfoot is a very fun way to get the hang of programming, as you can see any changes you make to the code in a video game setting. Additionally, there is a great community that can give help, ideas, and much more. So if you want a visual programming experience, Greenfoot is a great way to get started.
Geany
For those who want to have a good enough editor to do the nitty gritty programming, I recommend using Geany. It is available for all operating systems, is relatively lightweight, and simply gets the job done. There are indeed lots of other editors that people can choose from, and they’re welcome to use those instead, but my recommendation stays with Geany.
2 Recommended Websites
There are a couple of websites that can help you out if this introduction didn’t make much sense.
First is “Javanotes 6.0” which provides a much more lengthy but complete explanation of basic Java programming concepts. Here you’ll find loads of information and some programming exercises. If you have the time for it, it’s a great read.
Lastly, you can also check out HowStuffWorks’ page on Java. It also includes some information and guides you to making your first program. This is another interesting read, and involves a different first problem than the traditional “Hello World” example.
Conclusion
Getting started with Java isn’t as hard as it seems. With some time and practice you’ll get the hang of it, and from there you can build more complex programs that provides more functionality. Additionally, if you master the programming concepts, it’ll be easier to learn other programming languages as a large portion of the learning process is simply different syntax.
Let us know what your Java apps and tools are in the comments below.
No comments:
Post a Comment
[Please do not advertise, or post irrelevant links. Thank you for your cooperation.]