Java is a popular, high-level programming language known for its object-oriented programming features, portability, and reliability. It is widely used for software development, web applications, enterprise applications, backend systems, and many other areas.
Java is a high-level, general-purpose programming language developed to create different types of computer applications.
Java programs are commonly organized using classes and objects. Java also supports other programming techniques where appropriate.
Java was developed by James Gosling and his team at Sun Microsystems. Its development began in 1991, and Java was publicly released in 1995.
| Feature | Information |
|---|---|
| Creator | James Gosling and his team |
| Development Started | 1991 |
| First Released | 1995 |
| Original Name | Oak |
| Original Company | Sun Microsystems |
| Current Development | Oracle and the OpenJDK community |
| Type | High-level programming language |
Java is an important programming language for students who want to learn software development, object-oriented programming, and application development.
Java is used in many areas of software development and modern technology.
Java is designed to support different operating systems. A Java program can run on a system that has a compatible Java runtime environment.
| Operating System | Java Support |
|---|---|
| Windows | Yes |
| Linux | Yes |
| macOS | Yes |
Example: A compiled Java program can run on Windows or Linux if the required Java runtime and compatible dependencies are available.
Let's write our first Java program. The System.out.println() statement is used to display text on the screen.
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
The System.out.println() statement displays the text inside the parentheses and moves the cursor to the next line.
Save this program as Main.java. The filename must match the public class name.
Java syntax refers to the rules used to write valid Java programs. Java statements commonly end with semicolons, and curly braces define code blocks.
public class Main {
public static void main(String[] args) {
int number = 10;
if (number > 5) {
System.out.println("Number is greater than 5");
}
}
}
The curly braces define the class, method, and conditional block. Java is case-sensitive, so Main and main are different identifiers.
Java source code is compiled into bytecode. The Java Virtual Machine (JVM) executes this bytecode.
How Java works:
Java Source Code (.java)
|
v
Java Compiler (javac)
|
v
Bytecode (.class)
|
v
Java Virtual Machine (JVM)
|
v
Program Output
Important components:
javac
tool compiles Java source code into bytecode.
Java source code is normally saved using the .java file extension. After compilation, the compiler generally produces a .class file containing bytecode.
Compile the program:
javac Main.java
Run the program:
java Main
These commands work when a suitable JDK is installed and its tools are available in the command line.
| Feature | Java | Python | C |
|---|---|---|---|
| Syntax | Structured and explicit | Concise and readable | Structured and procedural |
| Programming Style | Supports OOP and other styles | Supports multiple paradigms | Primarily procedural |
| Execution | Bytecode on a JVM | Typically uses an interpreter/runtime | Typically compiled to native code |
| Memory Management | Garbage collection | Automatic memory management | Often managed by the programmer |
| Common Uses | Enterprise and backend applications | AI, data, automation, and web | Systems and embedded programming |
1. Who is commonly known as the father of Java?
2. What does JVM stand for?
3. Which file extension is normally used for Java source code?