Java Programming - Day 1 Notes
1. Java Overview
Java is a high-level, object-oriented programming language.
Key Features:
- Platform Independent (Write Once, Run Anywhere)
- Object-Oriented, Secure, Robust
- Multithreading support
- Rich standard and third-party libraries
2. Java Program Structure
Example:
public class HelloWorld {
public static void main(String[] args) {
[Link]("Hello, World!");
3. Java Data Types
Primitive Types:
- int: 1, 200, -34
- float: 3.14f
- double: 3.14159
- char: 'A'
- boolean: true, false
Non-Primitive:
- String: "Hello" (class)
Example:
int a = 10;
Java Programming - Day 1 Notes
float b = 5.5f;
char grade = 'A';
boolean passed = true;
String name = "Soumya";
4. Variables
Declaration: int x;
Initialization: x = 10;
Combined: int x = 10;
Naming convention: camelCase (e.g., studentName)
5. Operators
Arithmetic:
int a = 10, b = 3;
a + b, a - b, a * b, a / b, a % b
Relational: >, <, ==, !=
Logical: &&, ||, !
Assignment: x += 3, x++, x--
Practice Tasks
1. Write a program to display your name and age.
2. Declare and print all variable types.
3. Try all operators and print the results.