0% found this document useful (0 votes)
2 views3 pages

Unit 1 Introduction To Java Complete Notes

This document provides an introduction to Java programming, covering its history, platform, and key components like JDK, JRE, and JVM. It outlines Java's features, program structure, data types, variables, type casting, operators, control flow statements, and arrays. The content is structured to give a foundational understanding of Java for beginners.

Uploaded by

joshirudra0509
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Unit 1 Introduction To Java Complete Notes

This document provides an introduction to Java programming, covering its history, platform, and key components like JDK, JRE, and JVM. It outlines Java's features, program structure, data types, variables, type casting, operators, control flow statements, and arrays. The content is structured to give a foundational understanding of Java for beginners.

Uploaded by

joshirudra0509
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT 1: INTRODUCTION TO JAVA PROGRAMMING

1. Introduction to Java

• Java is a high-level, object-oriented, robust and secure programming language.


• Developed by James Gosling in 1991 at Sun Microsystems.
• Initially called Oak, renamed to Java in 1995.
• Follows WORA (Write Once Run Anywhere) principle.

2. Java Platform

• Java Platform consists of JVM and API.


• It is a software-based platform that runs on top of hardware platforms.

3. JDK, JRE, JVM

• JDK (Java Development Kit): Used to develop Java applications. Contains JRE and
development tools like javac.
• JRE (Java Runtime Environment): Used to run Java programs. Contains JVM and libraries.
• JVM (Java Virtual Machine): Executes Java bytecode and provides memory management and
garbage collection.
• Bytecode is platform independent; JVM is platform dependent.

4. Features of Java

• Simple and Object-Oriented


• Platform Independent and Portable
• Secure and Robust
• Multithreading Support
• Dynamic and Rich API

5. Structure of Java Program

• Documentation Section (Comments)


• Package Statement
• Import Statement
• Class Definition
• Main Method: public static void main(String[] args)
6. Data Types

• Primitive Types: byte, short, int, long, float, double, char, boolean
• Non-Primitive Types: String, Arrays, Classes, Objects
• Each datatype has specific size and default value.

7. Variables

• Local Variables: Declared inside methods.


• Instance Variables: Declared inside class but outside methods.
• Static Variables: Shared among all objects.
• Final Variables: Cannot be modified once assigned.

8. Type Casting

• Widening Casting: Smaller type to larger type (automatic).


• Narrowing Casting: Larger type to smaller type (manual).
• Example: int x = (int) 15.8; (loss of precision)

9. Operators

• Arithmetic: +, -, *, /, %
• Relational: ==, !=, >, <, >=, <=
• Logical: &&, ||, !
• Bitwise: &, |, ^, ~, <<, >>, >>>
• Assignment: =, +=, -=
• Ternary: (condition) ? value1 : value2
• Increment/Decrement: ++, -- (prefix and postfix)

10. Control Flow Statements

• Decision Making: if, if-else, switch


• Loops: for, while, do-while, for-each
• Jump Statements: break, continue
• while is entry-controlled; do-while is exit-controlled.
11. Arrays

• 1D Array: int[] arr = new int[5];


• 2D Array: int[][] arr = new int[3][3];
• Jagged Array: Different column sizes per row.
• Array features: Zero-based indexing, fixed size, stored in heap.
• Common Methods: sort(), binarySearch(), copyOfRange(), arraycopy()

You might also like