0% found this document useful (0 votes)
4 views4 pages

Co Java

Core Java notes cover the fundamentals of Java, including its features, architecture, and program structure. It explains key concepts such as JVM, JRE, JDK, data types, variables, operators, control statements, loops, and arrays. The document serves as a comprehensive guide for understanding Java programming basics.

Uploaded by

mehirow733
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)
4 views4 pages

Co Java

Core Java notes cover the fundamentals of Java, including its features, architecture, and program structure. It explains key concepts such as JVM, JRE, JDK, data types, variables, operators, control statements, loops, and arrays. The document serves as a comprehensive guide for understanding Java programming basics.

Uploaded by

mehirow733
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

Core Java Notes

1. Introduction to Java

• Java is a high-level, object-oriented, platform-independent programming language.

• Developed by Sun Microsystems (now owned by Oracle Corporation).

• Motto: Write Once, Run Anywhere (WORA).

Features of Java

• Platform Independent

• Object Oriented

• Secure

• Robust

• Multithreaded

• Portable

• High Performance

• Distributed

• Dynamic

2. JVM, JRE, JDK

JVM (Java Virtual Machine)

• Converts bytecode into machine code.

• Provides platform independence.

JRE (Java Runtime Environment)

• Contains JVM + libraries needed to run Java applications.

JDK (Java Development Kit)

• Contains JRE + development tools like compiler, debugger.

Architecture

Java Source Code (.java)



Compiler (javac)

Bytecode (.class)

JVM

Machine Code
3. Java Program Structure

class Hello {
public static void main(String[] args) {
[Link]("Hello World");
}
}

Explanation

• class → blueprint

• main() → execution starts here

• [Link]() → prints output

4. Data Types

Primitive Data Types

Type Size Example

byte 1 byte 10

short 2 bytes 200

int 4 bytes 1000

long 8 bytes 100000L

float 4 bytes 10.5f

double 8 bytes 20.55

char 2 bytes 'A'

boolean 1 bit true

Non-Primitive Types

• String

• Arrays

• Classes

• Interfaces

5. Variables

Types of Variables
1. Local Variable

2. Instance Variable

3. Static Variable

class Test {
int a = 10; // instance variable
static int b = 20; // static variable

void display() {
int c = 30; // local variable
}
}

6. Operators

Arithmetic Operators

+-*/%

Relational Operators

== != > < >= <=

Logical Operators

&& || !

Assignment Operators

= += -= *= /=

Unary Operators

++ --

7. Control Statements

If Statement

if(age >= 18){


[Link]("Eligible");
}

If-Else

if(num % 2 == 0)
[Link]("Even");
else
[Link]("Odd");

Switch
switch(day){
case 1: [Link]("Monday");
break;
default: [Link]("Invalid");
}

8. Loops

For Loop

for(int i=1; i<=5; i++){


[Link](i);
}

While Loop

while(i <= 5){


i++;
}

Do-While Loop

do{
i++;
}while(i <= 5);

9. Arrays

int arr[] = {1,2,3,4};

for(int i : arr){
[Link](i);
}

Types

• Single Dimensional

• Multidimensional

You might also like