Introduction to Java
Java is a high-level, object-oriented programming language that was developed by Sun Microsystems and released in 1995. It is widely used for building enterprise-level applications, Android apps, and web applications.
Features of Java
- Simple: The syntax of Java is similar to C++, making it easy to learn for developers who are familiar with C++ or C.
- Object-Oriented: Java follows the object-oriented programming paradigm, which means that everything in Java is an object and can be represented as a class.
- Platform Independent: Java programs can run on any operating system that has a Java Virtual Machine (JVM), making it platform-independent.
- Secure: Java has built-in security features that protect against viruses, tampering, and unauthorized data access.
- Robust: Java has features like garbage collection, exception handling, and strong memory management, which make it a robust programming language.
- Multithreaded: Java supports multithreading, allowing multiple tasks to run concurrently within a program.
Hello World Program
A common starting point for learning a programming language is to write a simple program that prints 'Hello, World!'. Here's how you can write a Hello World program in Java:
TEXT/X-JAVA
1// Java Hello World Program
2public class HelloWorld {
3
4 public static void main(String[] args) {
5 System.out.println("Hello, World!");
6 }
7
8}
When you run this program, it will output the text 'Hello, World!' to the console.
xxxxxxxxxx
// Java Hello World Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment