Java Programming - Day 1 Notes
What is Java?
Java is a high-level, object-oriented programming language developed by Sun Microsystems (now owned by
Oracle). It is platform-independent, which means you can run Java programs on any operating system using
the Java Virtual Machine (JVM).
Features of Java
- Simple and familiar
- Object-Oriented
- Platform Independent (Write Once, Run Anywhere)
- Secure
- Robust
- Multithreaded
First Java Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
Explanation
- public class HelloWorld: Every Java program must have at least one class.
- public static void main(String[] args): This is the entry point of the program.
- System.out.println("Hello, World!");: Prints the message to the console.
Java Programming - Day 1 Notes
To Run Java Code
1. Install JDK (Java Development Kit)
2. Use any text editor (Notepad, VS Code, etc.)
3. Save the file as HelloWorld.java
4. Open terminal/command prompt:
javac HelloWorld.java // Compiles the code
java HelloWorld // Runs the program