Multi-Dimensional Arrays in Java

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

The arrays you have likely been using so far have only held one column of data. But you can set up an array to hold more than one column. These are called multi-dimensional arrays.

Continue reading

Setting Up a Linux Based Tomcat Server (for Java Applications)

Watch out! This tutorial is over 8 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of Tomcat  on your Linux server.

Continue reading

Introduction to Java

Watch out! This tutorial is over 8 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. It was conceived by James Gosling and Patrick Naughton. It is a simple programming language.  Writing, compiling and debugging a program is easy in java.  It helps to create modular programs and reusable code and is ‘platform independent’.

Continue reading

Hello World in Java

Watch out! This tutorial is over 8 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

This is how you would display “Hello World” in your Java application.

We break the process of programming in Java into three steps:

  • Create the program by typing it into a text editor and saving it to a file named, say, HelloWorld.java.
  • Compile it by typing “javac HelloWorld.java” in the terminal window.
  • Execute (or run) it by typing “java HelloWorld” in the terminal window.

So, the code in our file would look like

public class HelloWorld {
   public static void main(String[] args) {
      // Prints "Hello, World" in the terminal window.
      System.out.println("Hello World");
   }
}

To compile HelloWorld.java type the text below at the terminal

javac HelloWorld.java

Once you compile your program, you can execute it. This is the exciting part, where the computer follows your instructions. To run the HelloWorld program, type the following in the terminal window:

java HelloWorld

That’s it!