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

Java Basics OOP Guide

The document provides a comprehensive guide to Java basics and object-oriented programming (OOP). It covers fundamental concepts such as program structure, data types, operators, control flow, and arrays, followed by OOP principles including classes, constructors, encapsulation, inheritance, polymorphism, and interfaces. A roadmap is included to suggest a learning path through the topics presented.

Uploaded by

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

Java Basics OOP Guide

The document provides a comprehensive guide to Java basics and object-oriented programming (OOP). It covers fundamental concepts such as program structure, data types, operators, control flow, and arrays, followed by OOP principles including classes, constructors, encapsulation, inheritance, polymorphism, and interfaces. A roadmap is included to suggest a learning path through the topics presented.

Uploaded by

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

Java Basics & OOP - Full Guide

PART 1: JAVA BASICS

1. Program Structure
Every Java program starts with:
public class Main {
public static void main(String[] args) {
// code
}
}

2. Variables & Data Types


int x = 5;
double price = 10.5;
char letter = 'A';
boolean isTrue = true;
String name = "Yahya";

3. Operators
+ - * / %

4. Input / Output
[Link]("Hello");

Scanner:
import [Link];
Scanner sc = new Scanner([Link]);

5. If / Else
if (x > 0) {
[Link]("Positive");
} else {
[Link]("Negative");
}

6. Switch
switch(day) {
case 1: break;
default: break;
}
7. Loops
for(int i=0;i<5;i++){}
while(i<5){}
do{}while(condition);

8. Arrays
int[] arr = {1,2,3};

9. Strings
String s = "Hello";

10. Random
Random r = new Random();

11. Date
Date d = new Date();

----------------------------

PART 2: OOP

1. Class & Object


class Student { String name; }

2. Constructor
Student(String n){ name=n; }

3. Methods
void sayHello(){}

4. Encapsulation
private + getters/setters

5. Inheritance
class Dog extends Animal

6. Polymorphism
method overriding

7. Abstraction
abstract class
8. Interface
interface Flyable
class Bird implements Flyable

9. this keyword
[Link] = name;

10. static
shared variable

----------------------------

ROADMAP:
Variables -> If -> Loops -> Arrays -> Strings -> OOP

You might also like