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

OOP Concepts and Java Basics Guide

The document outlines key Object-Oriented Programming (OOP) concepts including classes, objects, and abstraction. It also covers methods, string manipulation, loops, and basic math functions in programming. Essential syntax and examples for each concept are provided to aid understanding.

Uploaded by

ntnzbmai
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)
8 views3 pages

OOP Concepts and Java Basics Guide

The document outlines key Object-Oriented Programming (OOP) concepts including classes, objects, and abstraction. It also covers methods, string manipulation, loops, and basic math functions in programming. Essential syntax and examples for each concept are provided to aid understanding.

Uploaded by

ntnzbmai
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

OOP Concepts

1 . Class (‫)מחלקה‬: A blueprint or template for creating objects


2. Object(‫ )אובייקט‬: An instance of a class
3. Abstraction(‫ )אבסטרקצייה‬: Hiding complex details and showing only
functionality

Main Method: public static void main(String[] args)


Static is the function of the specific class.
this.x: "This" object that calls to the function

Methods / Functions
Connecting Variables Between A Function And Main: Type variable =
FunctionName(Variable 1, Variable 2,..)
Return Keyword: return value; (Exits function and sends value back)
Void Method: public static void name() { ... } (Returns nothing)

Setup & Storage


Scanner: Scanner s = new Scanner([Link]); Array Declaration: Type[]
variableName = new Type[size]; Function Return: Type result =
functionName(var1, var2);

String Basics
Initialize String: String variableName = "Hello World"; String Length:
[Link]() Check Char At: [Link](index)

String Search & Boolean


Find First Index: [Link](str) (Returns -1 if not found)
Find Last Index: [Link](str)
Check If Contains: [Link](str) (Returns true/false)

String Modification
Substring: [Link](beginIndex, endIndex)
Repeat: [Link](count)
To Lower Case: [Link]()
To Upper Case: [Link]()

Replace: [Link](target, replacement) (Replaces all


occurrences of target with replacement. Example: "hello".replace("l", "p") →
"heppo"

Split: String[] arrayName = [Link](delimiter) (Splits string into


an array based on the delimiter). Example: "a,b,c".split(",") → ["a", "b", "c"]

Loops
For Loop: for (int i = 0; i < 10; i++) { ... } For-Each Loop: for (Type item :
array) { ... } While Loop: while (condition) { ... } Do-While Loop: do { ... }
while (condition);

Math Class
Absolute Value: [Link](number) Power: [Link](base, exponent)
Square Root: [Link](number) Maximum: [Link](a, b) Minimum:
[Link](a, b) Random Number: [Link]() (Returns double between
0.0 and 1.0)

You might also like