Overview of Java Language

Here we will cover Overview of Java Programming language means what is java language, Types of Java, How to write first java program, Class declaration, Execution process of java etc. In other tutorial we have already covered history of Java, Features of Java and how to download JDK and set the path in environment variable. You can read that tutorial also.


Introduction

Java is a general purpose, widely used computer language, object oriented programming language. James Gosling is the creator of java. By using this we can develop two types of Java programs.

1.         Standalone application

2.         Web Applets

They are implemented as shown in Figure. Standalone applications are programs written in Java to perform of a certain tasks on a standalone local computer. In fact, Java can be used to develop programs for all kinds of applications, which earlier, were developed using language like C and C++. Implementing a standalone Java program involves two steps

1.         Compiling source code into bytecode using javac compiler.

2.         Executing the bytecode program using Java interpreter.

Applets are Java programs that run on web browser and developed for Internet applications. An applet located on a computer (Server) can be downloaded via internet and implemented on a local computer (Client) using a Java-capable browser. We can develop applets for doing everything from simple animated graphics to complex games and utilizes. Since applets are embedded in a HTML (Hypertext Markup Language) document and run inside a Web page, creating and running applets are more complex than creating an application.

    Standalone programs can read and write files and it can perform certain operations that applets cannot do. An applet can only be run within a Web browser. 

Overview Of Java

Simple Java Program

The right way to learn a new language is to practice a few simple example programs and execute them. We start with a very simple program that prints a line of text as output.

class FirstOne
{
   public static void main(String args[])
      {
         System.out.println(“Java is good programming language”);
      }
}

Class Declaration

The First line

class FirstOne – declares a class, which is a object oriented construct. Java is a object oriented language then everything should be place inside a class. class is a keyword and declares a new class definition follows. FirstOne is a Java identifier that specifies the name of the class to be defined.

Opening Brace

Every class definition start from opening braces ‘{’ and end with matching closing braces ‘}’.

The Main Line

public static void main(String args[])

This is the static method with name main. This is called main method of java class. This is staring point of the JVM to execute of the Java program. A java class can contain only one main method.

This line contains different Java keywords, public, static and void.

Public static void main

All parameters to a method are declared inside parentheses. Here, String args [] accepts a single argument of type array object which is also known as command line argument.

Output Line

System.out.println(“Java is good programming language”);

System : This is a final class in java.lang package.

Out: It is a static data member of System class and is of type PrintStream class

Println: It is a method of PrintStream class. This always appends newline character in last of the line means every output start with new line.

Java case sensitive

Compile and Execute Java Program using Command Line

Now save the above program with FirstOne.Java

1.         Go to Command line.

2.         Go to path where you saved your Java program

3.         Type – javac FirstOne.java  (This will compile your code.)

4.        Type- Java FirstOne     (This will run your code.)

Summary

In this tutorial, we have introduced Overview of java- purpose of Java, use of Java in developing the different types of application, some simple application programs to familiarize to the readers with basic Java structure how to declare the class, how to compile and execute them etc.

Leave a Comment