Geek Proud, GeekOut.

Java: What A Non-Programmer Needs To Know

Oft-criticised, rarely complimented, Java is very much a love-hate programming language: People absolutely love to hate it. It’s the language I begun with, which wasn’t the easiest choice, but the sheer number of Java jobs out there is simply overwhelming. Is this a language worth knowing, or is it dead on arrival? Oh… did I mention that Java is the language used to program Minecraft and all of the plugins associated with it? I bet that got your attention. Much like Python from two weeks ago, this is a broad, non-technical understanding of what Java is and what you need to know.


Why Should I Choose Java?

Java is a tough one to place on most programmers lists, in terms of when to use it or even what it’s best equipped to deal with. As such, this is probably a discussion that you’re going to hear lots of conflicting accounts on. Java is not the fastest; Java is not the smallest; Java is not the simplest. In fact, I could spend all year telling you what Java is not. So why on Earth would you ever use Java? Well as it turns out, there are some truly great benefits to this language, some of which are utilised in offices worldwide.

Portability via the Java Virtual Machine

Originally Java’s mantra was Write Once Run Everywhere, or WORE (also known as WORA (Write Once Run Anywhere)). Whilst this may sound strange, Java is truly still the language of portable simplicity. In contrast to Python, in which Python will run nicely on any platform, the object of the Java Virtual Machine is for all code that goes through to always be able to be run. What I mean by this, when you write Java code, it will be implementable anywhere, as the code has to go through the JVM. This has limitations, but it means you can create a program that sits nicely on a server and distribute it to work on client machines easily enough. All it takes is an installation of Java!

Java Class Libraries

Interestingly with Java, you import class libraries in order to get ahold of the best and more relevant functions for the job you’re looking to do. For instance, if you’d like to do something with a GUI, you would simply import the relevant class library to your code, which then opens up the functions for that class library. So, as an example taken from Wikipedia, the below code creates a new window with the words “Hello, world!” written inside:

import javax.swing.*;

public class javaTut extends JFrame {
super("hello");
super.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
super.add(new JLabel("Hello, world!"));
super.pack();
super.setVisible(true);
}
public static void main(String args []) {
new javaTut();
}
}

By using the import function right at the start, you’ve told Java that you want to use features from the javax.swing class library. Whilst the above code might not make much sense to you right now, we’re explaining that the class javaTut is going to extend JFrame, meaning it uses functionality from JFrame. We invoke ‘Super’ to explain we’re addressing the parent (a JFrame) and we can use functions, such as .add(new JLabel(“Hello, world!”)); or .pack();. There are many other ways to achieve the above, but that’s a pretty easy way to do it in Java.

The nice thing about the above code: It’ll work on all operating systems that has Java installed on it.

Android Development

Not a language feature, per se, but Java is the language most commonly associated with the Android operating system. As such, if you’re looking to make a nice game for the Google Play Store, then this is probably your best choice. You don’t have to limit yourself to Java, as there are tutorials online on how to use Java to then use other languages for the body of your code; but if you’re serious about wanting to do some Android development, you really will need to get to grips with Java.


There are many more reasons why you might want to get some Java experience behind you and these are just three reasons why you might want to pick Java as your programming language of choice. The third part isn’t related to Java itself, per se, but it certainly makes sense as to why it’s still a top language to learn. Perhaps you’re a Java developer who wants to share a few pointers for those wanting to learn the language? Did this article give you a good insight of what to expect? Leave us a comment below, or over on Facebook, Twitter or Reddit.

One response

  1. Pingback: Old School Runescape | GeekOut South-West

Drop us a line

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s