Introduction
Java is a programming language created by James
Gosling from Sun Microsystems in 1991. The first public available version of
Java (Java 1.0) was released 1995. Over time several version of Java were
released which enhanced the language and its libraries. The current version of
Java is Java 1.6 also known as Java 6.0. From the Java programming language the
Java platform evolved. The Java platform allows that code is written in other
languages then the Java programming language and still runs on the Java virtual
machine. The Java programming language consists out of a Java compiler the Java
virtual machine, and the Java class libraries. The Java virtual machine (JVM) is
a software implementation of a computer that executes programs like a real
machine. The Java compiler translates Java coding into so-called byte-code. The
Java virtual machine interprets this byte-code and runs the program.The Java
virtual machine is written specifically for a specific operating system. The
Java runtime environment (JRE) consists of the JVM and the Java class libraries.
Characteristics of Java
- Automatic memory management.
- Strongly-typed programming language.
- Interpreted and compiled language.
- Platform independent.
- Object-orientated programming language.
Example:
Simple display a factorial number in a java.
Code
public
class
NumberFactorial {
public
static void main(String[] args) {
int
number = 5;
int
factorial
= number;
for(int i =(number - 1); i > 1; i--)
{
factorial =
factorial * i;
}
System.out.println("Factorial
of a number is " + factorial);
}
}
Output
Factorial of a number is 120