Java_Basics_Notes
Java_Basics_Notes
Definition of Java
1995 (now owned by Oracle Corporation). It is designed to have as few implementation dependencies as
possible, which makes it a platform-independent language thanks to the Java Virtual Machine (JVM). Java is
widely used for building mobile applications (especially Android), web-based applications, enterprise-level
solutions, and more. Its philosophy is "Write Once, Run Anywhere" (WORA).
Features of Java
1. Simple: Easy to learn with a syntax similar to C++ but without complex features like pointers.
3. Platform Independent: Java code is compiled into bytecode which runs on any machine with a JVM.
4. Secure: Java provides runtime security features like bytecode verification and no explicit memory pointers.
5. Robust: Java handles memory management automatically with garbage collection and has strong
exception handling.
6. Multithreaded: Allows simultaneous execution of two or more threads for maximum CPU utilization.
8. Distributed: Java can be used to create distributed applications using tools like RMI and EJB.
9. Dynamic: Java can adapt to evolving environments through dynamic linking and loading of classes at
runtime.
Operators in Java
Java Operators
Relational ==, !=, >, <, >=, <= Compare two values
Expressions in Java
An expression in Java is a construct made up of variables, operators, and method calls that evaluates to a
single value.
Example:
Types of Expressions:
- Arithmetic Expressions: a + b, x * y
System.out.println("Hello, World!");
Explanation:
- public static void main(String[] args): The main method where the program starts execution.