Hello, Java

Resources

A quick guide | Java interview questions | Essential classes | Deployment | Create GUI with Swing | online java compiler

Why Java

Java, developed by Sun Microsystems Corporation, enjoys its popularity because it is a platform-independent, object-oriented programming (OOP) language, and because certain kinds of Java programs, called applets, can be embeded in Web pages.

Classes and Objects

Java SDK

we will use Eclipse. Try the Eclipse Installer (download), which provides the easiest way to install & update Eclipse.

The Java API

The Java API (the Java Application Programming Interface) contains a collection of packages (libraries); each package contains a collection of related Java classes. The Swing package, the AWT package, and the util package are among the commonly used packages.

Java Syntax Basics

"Hello World" in Java

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

"Hello World" with GUI

import javax.swing.*; 
public class HelloWorldGUI {
	public static void main(String[] args) {
		String name = JOptionPane.showInputDialog("What's your name?");
		JOptionPane.showMessageDialog(null, "Hello " + name);
	}
}

Compiling and Running a Simple Program

More advanced topics on java