Menu

Java Project Tutorials


Java is an object-oriented programming (OOPs) language.

We can develop web application and Enterprise application using java Enterprise Edition(j2ee).

Tools needed for run server side program

About this tutorial

In this tutorial basically, we provide different server technologis based programs like servlet, jsp those help a beginner to write server side program easily and create a java project of his own.

Example

Examples are better than 1000 words. Examples are often easier to understand than text explanations. So in this tutorial we only provide the example.

Let’s start with a simple Hello World! program

Hello world program

public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello world!");
}
}

import java.lang.*;

It is used to Import predefine classes and interfaces which contain methods.This process is called package insertion.A package is a collection of predefined classes and interfaces.

public class HelloDemo

We should declare class(interface) with public modifier to access within entire application or in different package.We have to use class keyword subsequent with class(interface)name.

public static void main(String[] args) { }

This is a main() method. JVM start execution from this line.We have to write same [public static void main(String[] args)] while declaring main() method.

Public is an access modifer which is accessable by JVM.Static is a key word.

Here main() method is declared as static means It can access only static variable which is declared out side the class but we can't create veriables out side the class but JVM may internally provide static variable which is accessed by the main() method.

void is a return type and its menas return nothing because we know java is platefome independent and no need to return value to operating system or JVM.

main is the special user define function. Though it is user define but We can't change the name.

String[] args means we create a string type array. It is useful when we pass the value through command line while execute the program.

Note : args is an array name therefore it is treated as an idetifire means we can change the it and put any name.

System.out.println("Hello World!");

This is output statement.We use print() or println() method to print the message or value of variables.

print() method is define under predefined class System. print() method is called through out object which is also predefined.we can't change it.