SlideShare a Scribd company logo
Object oriented programming
(first )
By Eng.abed albaset hamam
Introduction
• general depiction of a java class using a
programming environment such as eclipse :
• //Package
• //import directives
• Access-Modifiers class className{
• // variables
• // Method ( functions) definitions
• }
Simple example
public class tom {
public static void main(String[] args) {
System.out.println("simple");
}}
• Why static ? static is keyword indicating the
method is static which means it has static address
which must determined at compile time
Questions for the previous example
• What main mean ? keyword which means an
address where the application or program will
start executing
What the output ??
System.out.println("abt"hello"");
The output abd "hello"
What the output ??
public class Mainx {
public static void main(String[] args) {
int x=3;
int y=4;
System.out.println(x+y);
}
}
Output 7
functions
• public class MyClass{
• public static void main(String[] args) {
• funA(); // direct function call statement
• System.out.print("bye");
• }
• static void funA(){
• //function body begin
• System.out.print("No value to return");
• }//function body ends
• }
Q for previous ex
• Questions :
• 1- What is the function name?
• 2- What is the function header?
• 4- Why the function does not have a return
statement?
• Answers :
• 1- FunA
• 2- Static void funA()
• 4- Because the function return data type field is
void, therefore it return
Overloading
• public class Mainx {
• public static void main(String[] args) {
• System.out.print(Fun(2.00));
• }
• static int fun(int x){
• return 1;
• }
• static int fun(double x){
• return 1;
• }
• static int fun(int x, int y){
• return 1;
• }
• }
Visibility
• public class tom {
• public static void main(String[] args) {
• {
• char c='a';
• }
• System.out.println(c);//error c not visible
• }
• }
• In can see the out but out cant see the in
visiblity
• static int Fun(int x){
• int z=1;
• {
• int x=4;// Naming collision error, x is already
declared
• }
• return 0;
• }
Recursive functions
• Example 10: Finding the factorial of an integer by using recursive function
calls
• public class Mainx {
• public static void main(String[] args) {
• int z=4;
• System.out.println(factorial(z));
• }
• static int factorial(int x){
• if(x==0)
• return 1;
• else
• return x*factorial(x-1);
• }
• }
Arrays
• One dimensional array
• public class Mainx {
• public static void main(String[] args) {
• int a[]={1,2,3};
• for(int i=0;i<3;i++){
• System.out.print(a[i]);
• }
• }
• }
Arrays
• Two dimensional arrays
• int a[][]={{1,2}, {3,4}};
• for(int i=0;i<2;i++){
• for(int j=0;j<2;j++){
• System.out.print(a[i][j]);
• }
• System.out.print("n");
• }
Find the error
• public class MyClass {
• public static void main(String[] args) {
• int x=5;
• {
• int x=6;
• }
• System.out.println(x);
• }
• }
Find the error
• public class MyClass {
• public static void main(String[] args) {
• int x=fun();
• }
• public int fun(){
• System.out.println("hello");
• return 1;
• }
• }
Find the error
• public class MyClass {
• public static void main(String[] args) {
• int x=1;
• if(x>=1){
• int y=3;
• }
• System.out.println(x+y);
• }
• }
Find the error
• public class MyClass {
• public static void main(String[] args) {
• fun(3);
• }
• static void fun(int z){
• int z=3;
• }
• }
What the output
• public class MyClass {
• public static void main(String[] args) {
• int a[]={1,2,3};
• System.out.println(fun(a));
• }
• public static int fun(int a[]){
• int sum=0;
• for(int i=0;i<3;i++){
• sum+=a[i];
• }
• return sum;
• }
• }
What the output
• public class tom {
• public static int fun(int x){
• return ++x;
• }
• public static void main(String[] args) {
• int z=4;
• z=fun(fun(fun(z)));
• System.out.println(z);
• }
• }
Find the error
• public class tom {
• public static int fun(int x){
• return x;
• }
• public static void main(String[] args) {
• double z=4;
• z=fun(fun(fun(z)));
• System.out.println(z);
• }
• }
Class variable
• public class tom {
• static int z=2;
• public static void fun2(){
• System.out.println(++z);
• }
• public static void fun3(){
• System.out.println(++z);
• }
• public static void main(String[] args) {
• fun3(); fun2();
• }
• }
What the output
• public class tom {
• static int z=8;
• public static void fun2(){
• System.out.println(++z);
• }
• public static void fun3(){
• System.out.println(++z);
• }
• public static void main(String[] args) {
• fun3(); fun2();fun3(); fun2();
• }
• }
What the output
• public class MyClass {
• static int z=5;
• public static void fun1(int x){
• int z=4,y=5;
System.out.println(x+y+z);
• }
• public static void fun2(int k){
• int x=1, y=2;
• System.out.println(x+y+k+z);
• }
• public static void main(String[] args) { fun1(1);fun2(2); } }
Defined the object
• MyClass objref = new MyClass(value);
constructur
Example on objects
What the output
What the error
this
Ad

More Related Content

What's hot (20)

Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
Chhom Karath
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
Soumya Behera
 
Fourier project presentation
Fourier project  presentationFourier project  presentation
Fourier project presentation
志璿 楊
 
JDays 2016 - Beyond Lambdas - the Aftermath
JDays 2016 - Beyond Lambdas - the AftermathJDays 2016 - Beyond Lambdas - the Aftermath
JDays 2016 - Beyond Lambdas - the Aftermath
Daniel Sawano
 
Spotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the AftermathSpotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the Aftermath
Daniel Sawano
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
raksharao
 
Java practical(baca sem v)
Java practical(baca sem v)Java practical(baca sem v)
Java practical(baca sem v)
mehul patel
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
Java Puzzle
Java PuzzleJava Puzzle
Java Puzzle
SFilipp
 
Java puzzles
Java puzzlesJava puzzles
Java puzzles
Nikola Petrov
 
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
tdc-globalcode
 
Java Unit 1 Project
Java Unit 1 ProjectJava Unit 1 Project
Java Unit 1 Project
Matthew Abela Medici
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
knutmork
 
Java Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APIJava Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream API
Svetlin Nakov
 
Collection Core Concept
Collection Core ConceptCollection Core Concept
Collection Core Concept
Rays Technologies
 
Idiomatic Kotlin
Idiomatic KotlinIdiomatic Kotlin
Idiomatic Kotlin
intelliyole
 
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
Mahmoud Samir Fayed
 
Java Puzzlers
Java PuzzlersJava Puzzlers
Java Puzzlers
Mike Donikian
 
Java Generics
Java GenericsJava Generics
Java Generics
Zülfikar Karakaya
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
Alok Kumar
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
Chhom Karath
 
Fourier project presentation
Fourier project  presentationFourier project  presentation
Fourier project presentation
志璿 楊
 
JDays 2016 - Beyond Lambdas - the Aftermath
JDays 2016 - Beyond Lambdas - the AftermathJDays 2016 - Beyond Lambdas - the Aftermath
JDays 2016 - Beyond Lambdas - the Aftermath
Daniel Sawano
 
Spotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the AftermathSpotify 2016 - Beyond Lambdas - the Aftermath
Spotify 2016 - Beyond Lambdas - the Aftermath
Daniel Sawano
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
raksharao
 
Java practical(baca sem v)
Java practical(baca sem v)Java practical(baca sem v)
Java practical(baca sem v)
mehul patel
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
Java Puzzle
Java PuzzleJava Puzzle
Java Puzzle
SFilipp
 
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
tdc-globalcode
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
knutmork
 
Java Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APIJava Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream API
Svetlin Nakov
 
Idiomatic Kotlin
Idiomatic KotlinIdiomatic Kotlin
Idiomatic Kotlin
intelliyole
 
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
Mahmoud Samir Fayed
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
Alok Kumar
 

Viewers also liked (16)

Reconeixer les monedes deuro
Reconeixer les monedes deuroReconeixer les monedes deuro
Reconeixer les monedes deuro
Helena Enseñat
 
Morning routines
Morning routinesMorning routines
Morning routines
Julia Giroldi
 
CV - Lazar_Gavric.PDF
CV - Lazar_Gavric.PDFCV - Lazar_Gavric.PDF
CV - Lazar_Gavric.PDF
Lazar Gavric
 
Types of family
Types of familyTypes of family
Types of family
Julia Giroldi
 
Global Warming
Global WarmingGlobal Warming
Global Warming
Julia Giroldi
 
Ecological problems in estonia
Ecological problems in estoniaEcological problems in estonia
Ecological problems in estonia
Timo Priinits
 
Weather and activities
Weather and activitiesWeather and activities
Weather and activities
Julia Giroldi
 
Delivery at Hooroo
Delivery at HoorooDelivery at Hooroo
Delivery at Hooroo
Phil Metcalfe
 
Rules for classrooms
Rules for classroomsRules for classrooms
Rules for classrooms
Julia Giroldi
 
Engl 102 final exam 1
Engl 102 final exam 1Engl 102 final exam 1
Engl 102 final exam 1
scorpions1232
 
Engl 102 final exam 3
Engl 102 final exam 3Engl 102 final exam 3
Engl 102 final exam 3
scorpions1232
 
How to avoid to get sick.
How to avoid to get sick.How to avoid to get sick.
How to avoid to get sick.
Julia Giroldi
 
Uts pak soko
Uts pak sokoUts pak soko
Uts pak soko
emon_19
 
Motivational quotes discussion 2
Motivational quotes discussion 2Motivational quotes discussion 2
Motivational quotes discussion 2
prncss042304
 
Your face _farsi_
Your face _farsi_Your face _farsi_
Your face _farsi_
Fibamicro1
 
PRO INDUSTRY LTD. - portfolio
PRO INDUSTRY LTD. - portfolioPRO INDUSTRY LTD. - portfolio
PRO INDUSTRY LTD. - portfolio
Lazar Gavric
 
Reconeixer les monedes deuro
Reconeixer les monedes deuroReconeixer les monedes deuro
Reconeixer les monedes deuro
Helena Enseñat
 
CV - Lazar_Gavric.PDF
CV - Lazar_Gavric.PDFCV - Lazar_Gavric.PDF
CV - Lazar_Gavric.PDF
Lazar Gavric
 
Ecological problems in estonia
Ecological problems in estoniaEcological problems in estonia
Ecological problems in estonia
Timo Priinits
 
Weather and activities
Weather and activitiesWeather and activities
Weather and activities
Julia Giroldi
 
Rules for classrooms
Rules for classroomsRules for classrooms
Rules for classrooms
Julia Giroldi
 
Engl 102 final exam 1
Engl 102 final exam 1Engl 102 final exam 1
Engl 102 final exam 1
scorpions1232
 
Engl 102 final exam 3
Engl 102 final exam 3Engl 102 final exam 3
Engl 102 final exam 3
scorpions1232
 
How to avoid to get sick.
How to avoid to get sick.How to avoid to get sick.
How to avoid to get sick.
Julia Giroldi
 
Uts pak soko
Uts pak sokoUts pak soko
Uts pak soko
emon_19
 
Motivational quotes discussion 2
Motivational quotes discussion 2Motivational quotes discussion 2
Motivational quotes discussion 2
prncss042304
 
Your face _farsi_
Your face _farsi_Your face _farsi_
Your face _farsi_
Fibamicro1
 
PRO INDUSTRY LTD. - portfolio
PRO INDUSTRY LTD. - portfolioPRO INDUSTRY LTD. - portfolio
PRO INDUSTRY LTD. - portfolio
Lazar Gavric
 
Ad

Similar to Object oriented programming (first) (20)

Lab 3
Lab 3Lab 3
Lab 3
vishal choudhary
 
Java_Programming_by_Example_6th_Edition.pdf
Java_Programming_by_Example_6th_Edition.pdfJava_Programming_by_Example_6th_Edition.pdf
Java_Programming_by_Example_6th_Edition.pdf
JayveeCultivo
 
Topic 3
Topic 3Topic 3
Topic 3
DiyarAldusky
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Víctor Bolinches
 
Java introduction
Java introductionJava introduction
Java introduction
Samsung Electronics Egypt
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
walia Shaan
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...
MaruMengesha
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
jagriti srivastava
 
Introduccion del curso
Introduccion del cursoIntroduccion del curso
Introduccion del curso
Wilfredo Nieves
 
Parameters
ParametersParameters
Parameters
James Brotsos
 
Java Program
Java ProgramJava Program
Java Program
Sudeep Singh
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
Paulo Morgado
 
final year project center in Coimbatore
final year project center in Coimbatorefinal year project center in Coimbatore
final year project center in Coimbatore
cbeproject centercoimbatore
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
Closer look at classes
Closer look at classesCloser look at classes
Closer look at classes
yugandhar vadlamudi
 
Java Programs
Java ProgramsJava Programs
Java Programs
vvpadhu
 
Java 5 and 6 New Features
Java 5 and 6 New FeaturesJava 5 and 6 New Features
Java 5 and 6 New Features
Jussi Pohjolainen
 
Basic program in java
Basic program in java Basic program in java
Basic program in java
Sudeep Singh
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
Qiangning Hong
 
Comp102 lec 7
Comp102   lec 7Comp102   lec 7
Comp102 lec 7
Fraz Bakhsh
 
Java_Programming_by_Example_6th_Edition.pdf
Java_Programming_by_Example_6th_Edition.pdfJava_Programming_by_Example_6th_Edition.pdf
Java_Programming_by_Example_6th_Edition.pdf
JayveeCultivo
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Víctor Bolinches
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
walia Shaan
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_01-Mar-2021_L12...
MaruMengesha
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
jagriti srivastava
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
Paulo Morgado
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
Java Programs
Java ProgramsJava Programs
Java Programs
vvpadhu
 
Basic program in java
Basic program in java Basic program in java
Basic program in java
Sudeep Singh
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
Qiangning Hong
 
Ad

Recently uploaded (20)

5kW Solar System in India – Cost, Benefits & Subsidy 2025
5kW Solar System in India – Cost, Benefits & Subsidy 20255kW Solar System in India – Cost, Benefits & Subsidy 2025
5kW Solar System in India – Cost, Benefits & Subsidy 2025
Ksquare Energy Pvt. Ltd.
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Hundred applicable AI Cases for oil and Gas
Hundred applicable AI Cases for oil and GasHundred applicable AI Cases for oil and Gas
Hundred applicable AI Cases for oil and Gas
bengsoon3
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
Transcript: Canadian book publishing: Insights from the latest salary survey ...
Transcript: Canadian book publishing: Insights from the latest salary survey ...Transcript: Canadian book publishing: Insights from the latest salary survey ...
Transcript: Canadian book publishing: Insights from the latest salary survey ...
BookNet Canada
 
Connect and Protect: Networks and Network Security
Connect and Protect: Networks and Network SecurityConnect and Protect: Networks and Network Security
Connect and Protect: Networks and Network Security
VICTOR MAESTRE RAMIREZ
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Play It Safe: Manage Security Risks - Google Certificate
Play It Safe: Manage Security Risks - Google CertificatePlay It Safe: Manage Security Risks - Google Certificate
Play It Safe: Manage Security Risks - Google Certificate
VICTOR MAESTRE RAMIREZ
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
5kW Solar System in India – Cost, Benefits & Subsidy 2025
5kW Solar System in India – Cost, Benefits & Subsidy 20255kW Solar System in India – Cost, Benefits & Subsidy 2025
5kW Solar System in India – Cost, Benefits & Subsidy 2025
Ksquare Energy Pvt. Ltd.
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Hundred applicable AI Cases for oil and Gas
Hundred applicable AI Cases for oil and GasHundred applicable AI Cases for oil and Gas
Hundred applicable AI Cases for oil and Gas
bengsoon3
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
Transcript: Canadian book publishing: Insights from the latest salary survey ...
Transcript: Canadian book publishing: Insights from the latest salary survey ...Transcript: Canadian book publishing: Insights from the latest salary survey ...
Transcript: Canadian book publishing: Insights from the latest salary survey ...
BookNet Canada
 
Connect and Protect: Networks and Network Security
Connect and Protect: Networks and Network SecurityConnect and Protect: Networks and Network Security
Connect and Protect: Networks and Network Security
VICTOR MAESTRE RAMIREZ
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Play It Safe: Manage Security Risks - Google Certificate
Play It Safe: Manage Security Risks - Google CertificatePlay It Safe: Manage Security Risks - Google Certificate
Play It Safe: Manage Security Risks - Google Certificate
VICTOR MAESTRE RAMIREZ
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 

Object oriented programming (first)

  • 1. Object oriented programming (first ) By Eng.abed albaset hamam
  • 2. Introduction • general depiction of a java class using a programming environment such as eclipse : • //Package • //import directives • Access-Modifiers class className{ • // variables • // Method ( functions) definitions • }
  • 3. Simple example public class tom { public static void main(String[] args) { System.out.println("simple"); }} • Why static ? static is keyword indicating the method is static which means it has static address which must determined at compile time
  • 4. Questions for the previous example • What main mean ? keyword which means an address where the application or program will start executing What the output ?? System.out.println("abt"hello""); The output abd "hello"
  • 5. What the output ?? public class Mainx { public static void main(String[] args) { int x=3; int y=4; System.out.println(x+y); } } Output 7
  • 6. functions • public class MyClass{ • public static void main(String[] args) { • funA(); // direct function call statement • System.out.print("bye"); • } • static void funA(){ • //function body begin • System.out.print("No value to return"); • }//function body ends • }
  • 7. Q for previous ex • Questions : • 1- What is the function name? • 2- What is the function header? • 4- Why the function does not have a return statement? • Answers : • 1- FunA • 2- Static void funA() • 4- Because the function return data type field is void, therefore it return
  • 8. Overloading • public class Mainx { • public static void main(String[] args) { • System.out.print(Fun(2.00)); • } • static int fun(int x){ • return 1; • } • static int fun(double x){ • return 1; • } • static int fun(int x, int y){ • return 1; • } • }
  • 9. Visibility • public class tom { • public static void main(String[] args) { • { • char c='a'; • } • System.out.println(c);//error c not visible • } • } • In can see the out but out cant see the in
  • 10. visiblity • static int Fun(int x){ • int z=1; • { • int x=4;// Naming collision error, x is already declared • } • return 0; • }
  • 11. Recursive functions • Example 10: Finding the factorial of an integer by using recursive function calls • public class Mainx { • public static void main(String[] args) { • int z=4; • System.out.println(factorial(z)); • } • static int factorial(int x){ • if(x==0) • return 1; • else • return x*factorial(x-1); • } • }
  • 12. Arrays • One dimensional array • public class Mainx { • public static void main(String[] args) { • int a[]={1,2,3}; • for(int i=0;i<3;i++){ • System.out.print(a[i]); • } • } • }
  • 13. Arrays • Two dimensional arrays • int a[][]={{1,2}, {3,4}}; • for(int i=0;i<2;i++){ • for(int j=0;j<2;j++){ • System.out.print(a[i][j]); • } • System.out.print("n"); • }
  • 14. Find the error • public class MyClass { • public static void main(String[] args) { • int x=5; • { • int x=6; • } • System.out.println(x); • } • }
  • 15. Find the error • public class MyClass { • public static void main(String[] args) { • int x=fun(); • } • public int fun(){ • System.out.println("hello"); • return 1; • } • }
  • 16. Find the error • public class MyClass { • public static void main(String[] args) { • int x=1; • if(x>=1){ • int y=3; • } • System.out.println(x+y); • } • }
  • 17. Find the error • public class MyClass { • public static void main(String[] args) { • fun(3); • } • static void fun(int z){ • int z=3; • } • }
  • 18. What the output • public class MyClass { • public static void main(String[] args) { • int a[]={1,2,3}; • System.out.println(fun(a)); • } • public static int fun(int a[]){ • int sum=0; • for(int i=0;i<3;i++){ • sum+=a[i]; • } • return sum; • } • }
  • 19. What the output • public class tom { • public static int fun(int x){ • return ++x; • } • public static void main(String[] args) { • int z=4; • z=fun(fun(fun(z))); • System.out.println(z); • } • }
  • 20. Find the error • public class tom { • public static int fun(int x){ • return x; • } • public static void main(String[] args) { • double z=4; • z=fun(fun(fun(z))); • System.out.println(z); • } • }
  • 21. Class variable • public class tom { • static int z=2; • public static void fun2(){ • System.out.println(++z); • } • public static void fun3(){ • System.out.println(++z); • } • public static void main(String[] args) { • fun3(); fun2(); • } • }
  • 22. What the output • public class tom { • static int z=8; • public static void fun2(){ • System.out.println(++z); • } • public static void fun3(){ • System.out.println(++z); • } • public static void main(String[] args) { • fun3(); fun2();fun3(); fun2(); • } • }
  • 23. What the output • public class MyClass { • static int z=5; • public static void fun1(int x){ • int z=4,y=5; System.out.println(x+y+z); • } • public static void fun2(int k){ • int x=1, y=2; • System.out.println(x+y+k+z); • } • public static void main(String[] args) { fun1(1);fun2(2); } }
  • 24. Defined the object • MyClass objref = new MyClass(value);
  • 29. this