Java Introduction


Here is a quick rundown on the basics of Java…


The Java SDK and JVM-

Download Java SDK at the SUN website. Also get software like JCreator, BlueJ or eclipse for your comfort. – Eclipse for Java developer’s – JCreator LE version(it’s free)

Also do download the Java Documentation from SUN, it’ll help you a lot in development.

All these will be necessary , if you are going to write code in Java.

If you just want to learn the concepts, then don’t bother. But I tell you this, coding in java is the easiest and best way to learn it. And to top it all it’s fun, atleast for people like me.

Well let’s make you understand some basic stuff,

Class – It’s a template (or just something for now) from which you create objects.

Objects – Most of the operations in java are performed on an object. An object is an instance of a class.

If you didn’t get it don’t worry, just keep reading.

Here is a class,

class Student
private String name;

public Student(String name)
{ = name;

public void getName()

public static void main(String args[])
Student st = new Student(“Jovian”);


This is a class student which gives you an outline of what does it contain. It specifies some fields , in this case it is the name of the student. Also it specifies some method, in this case it is getName() which when executed will return the name of the student.

Note the code inside the main(),

Student st = new Student(“Jovian”);

Here st is an object of class Student. “st” has the field name and the method getName() which is specified by the class.

To call the method getName we use


Let’s assume that I write this piece of code in a file named as

when i compile this file a class file is created and it is saved at the same directory where exists.

Now let’s break up this process,

After you install Java and set the environment variables [ refer to Java -Environment Variables Topic] you have an SDK i.e. Software Development Kit, which has something called a JVM [ Java Virtual Machine ].

The JVM compiles the java file and lets you know if you have any errors. Thus compilation leads to forming of the class file. The name of the class file will be the name of the class which you have specified in the file. In this case it’ll be Student.

Now lets see how to execute the code,

when you run command > java Student

The JVM interprets the class file into the binary file and is executed by the machine. And you get the output as Jovian which is the name of the student.

Thus Java language is an compiled and interpreted.


One thought on “Java Introduction

Leave a Reply

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

You are commenting using your 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