SlideShare a Scribd company logo
1 of 12
Download to read offline
int a=1,b=2,temp;
temp=b;
b=a;
a=temp;
public class Operasi{
public Object a,b;
private Object temp;
Public void tukarNilai(){
temp=b;
b=a;
a=temp;
}
}
public static void main(String args[]){
Operasi opr = new Operasi();
opr.a=“a”;
opr.b=“b”;
opr.tukarNilai();
}
public static void main(String args[]){
Operasi opr = new Operasi();
opr.a=1;
opr.b=2;
opr.tukarNilai();
}
public class Operasi <T>{
public T a,b;
private T temp;
Public void tukarNilai(){
temp=b;
b=a;
a=temp;
}
}
public static void main(String args[]){
Operasi<Integer> opr = new Operasi<Integer>();
opr.a=1;
opr.b=2;
opr.tukarNilai();
}
public static void main(String args[]){
Operasi<String> opr = new Operasi<String>();
opr.a=“a”;
opr.b=“b”;
opr.tukarNilai();
}
Object Oriented Programing - Generic Programing

More Related Content

What's hot

CTF問題解説 OSのタスク切換え
CTF問題解説 OSのタスク切換えCTF問題解説 OSのタスク切換え
CTF問題解説 OSのタスク切換えmono0x
 
Progrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e imparesProgrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e imparesnacho155
 
Progrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e imparesProgrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e imparesnacho155
 
Metodo newton-raphson
Metodo newton-raphsonMetodo newton-raphson
Metodo newton-raphsondhanniell
 
珠三角技术沙龙新语言场 C++11
珠三角技术沙龙新语言场 C++11珠三角技术沙龙新语言场 C++11
珠三角技术沙龙新语言场 C++11翀 周
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Dr. Loganathan R
 
Sujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correctionSujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correctionborhen boukthir
 

What's hot (17)

Triangle
TriangleTriangle
Triangle
 
Program
ProgramProgram
Program
 
Passato
PassatoPassato
Passato
 
CTF問題解説 OSのタスク切換え
CTF問題解説 OSのタスク切換えCTF問題解説 OSのタスク切換え
CTF問題解説 OSのタスク切換え
 
Progrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e imparesProgrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e impares
 
Progrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e imparesProgrma para calcular los numeros pares e impares
Progrma para calcular los numeros pares e impares
 
Pilas
PilasPilas
Pilas
 
Librerias de c++
Librerias de c++Librerias de c++
Librerias de c++
 
Dij
DijDij
Dij
 
Metodo newton-raphson
Metodo newton-raphsonMetodo newton-raphson
Metodo newton-raphson
 
feedback
feedback feedback
feedback
 
珠三角技术沙龙新语言场 C++11
珠三角技术沙龙新语言场 C++11珠三角技术沙龙新语言场 C++11
珠三角技术沙龙新语言场 C++11
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2
 
07 3 do-while반복문
07 3 do-while반복문07 3 do-while반복문
07 3 do-while반복문
 
Sujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correctionSujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correction
 
Funciones
FuncionesFunciones
Funciones
 
MFC ELC
MFC ELCMFC ELC
MFC ELC
 

Viewers also liked (15)

LA JUSTICE CLIMATIQUE AU CŒUR DE LA MISE EN OEUVRE DE L'ACCORD DE PARIS
LA JUSTICE CLIMATIQUE AU CŒUR DE LA MISE EN OEUVRE DE L'ACCORD DE PARISLA JUSTICE CLIMATIQUE AU CŒUR DE LA MISE EN OEUVRE DE L'ACCORD DE PARIS
LA JUSTICE CLIMATIQUE AU CŒUR DE LA MISE EN OEUVRE DE L'ACCORD DE PARIS
 
P.1 LA MULTICULTURALITAT
P.1 LA MULTICULTURALITATP.1 LA MULTICULTURALITAT
P.1 LA MULTICULTURALITAT
 
sprimbet american
sprimbet americansprimbet american
sprimbet american
 
napollu spring bed
napollu spring bednapollu spring bed
napollu spring bed
 
345
345345
345
 
15490719 182782553-182782817
15490719 182782553-18278281715490719 182782553-182782817
15490719 182782553-182782817
 
Biology homework help
Biology homework helpBiology homework help
Biology homework help
 
Power pont historia
Power pont historiaPower pont historia
Power pont historia
 
toko spring bed
toko spring bedtoko spring bed
toko spring bed
 
Plan de gestion guaure mogotes
Plan de gestion guaure mogotesPlan de gestion guaure mogotes
Plan de gestion guaure mogotes
 
PROCESS_HU
PROCESS_HUPROCESS_HU
PROCESS_HU
 
T.linea
T.lineaT.linea
T.linea
 
El Gita simplificado
El Gita simplificadoEl Gita simplificado
El Gita simplificado
 
tp34 (5)
tp34 (5)tp34 (5)
tp34 (5)
 
La clave de los neutrinos
La clave de los neutrinosLa clave de los neutrinos
La clave de los neutrinos
 

More from Bayu Firmawan Paoh

[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...
[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...
[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...Bayu Firmawan Paoh
 
Object Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismObject Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismBayu Firmawan Paoh
 
Object Oriented Programing-Intro
Object Oriented Programing-IntroObject Oriented Programing-Intro
Object Oriented Programing-IntroBayu Firmawan Paoh
 
Object Oriented Programing - Inheritance
Object Oriented Programing - InheritanceObject Oriented Programing - Inheritance
Object Oriented Programing - InheritanceBayu Firmawan Paoh
 
Object Oriented Programing - Intro
Object Oriented Programing - IntroObject Oriented Programing - Intro
Object Oriented Programing - IntroBayu Firmawan Paoh
 
Presentation facade design pattern
Presentation facade design patternPresentation facade design pattern
Presentation facade design patternBayu Firmawan Paoh
 
Make Recyclerview With Android Studio
Make Recyclerview With Android StudioMake Recyclerview With Android Studio
Make Recyclerview With Android StudioBayu Firmawan Paoh
 
Android fundamental development
Android fundamental developmentAndroid fundamental development
Android fundamental developmentBayu Firmawan Paoh
 
Android - Getting Started With Firebase Auth
Android - Getting Started With Firebase AuthAndroid - Getting Started With Firebase Auth
Android - Getting Started With Firebase AuthBayu Firmawan Paoh
 
How to make e-commerce with oscmax
How to make e-commerce with oscmaxHow to make e-commerce with oscmax
How to make e-commerce with oscmaxBayu Firmawan Paoh
 

More from Bayu Firmawan Paoh (12)

[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...
[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...
[Seminar] ANALISIS KORELASI VARIABEL KONDISI LINGKUNGAN KANDANG TERHADAP KUAL...
 
Object Oriented Programing - Polymrphism
Object Oriented Programing - PolymrphismObject Oriented Programing - Polymrphism
Object Oriented Programing - Polymrphism
 
Object Oriented Programing-Intro
Object Oriented Programing-IntroObject Oriented Programing-Intro
Object Oriented Programing-Intro
 
Object Oriented Programing - Inheritance
Object Oriented Programing - InheritanceObject Oriented Programing - Inheritance
Object Oriented Programing - Inheritance
 
Object Oriented Programing - Intro
Object Oriented Programing - IntroObject Oriented Programing - Intro
Object Oriented Programing - Intro
 
Presentation facade design pattern
Presentation facade design patternPresentation facade design pattern
Presentation facade design pattern
 
Make Recyclerview With Android Studio
Make Recyclerview With Android StudioMake Recyclerview With Android Studio
Make Recyclerview With Android Studio
 
Android fundamental development
Android fundamental developmentAndroid fundamental development
Android fundamental development
 
Basic Android Layout
Basic Android LayoutBasic Android Layout
Basic Android Layout
 
Android - Getting Started With Firebase Auth
Android - Getting Started With Firebase AuthAndroid - Getting Started With Firebase Auth
Android - Getting Started With Firebase Auth
 
Basic Scala
Basic ScalaBasic Scala
Basic Scala
 
How to make e-commerce with oscmax
How to make e-commerce with oscmaxHow to make e-commerce with oscmax
How to make e-commerce with oscmax
 

Object Oriented Programing - Generic Programing