SlideShare a Scribd company logo
1 of 26
OOP
Package
import
Imprt java.awt.*;
Class
Class nabil}
Public nabil)(
}
}
void AnyName)(
}
}
Public static void main)String args][(
}
}
}
Constructornabilnabil
nabil nnn=new nabil)(;
mainstaticstatic.
Java Structure Program:
Package Name;
Import Java Class;
Public classes NameClasss
}
//declaver of variables
int I;
char c;
Jlabel l1;
.
.
.
public void NameClass)(
}
System.out.println)""(;
}
Void show)(
}
System.out.println)"i="+i(;
}
public static void main)String][ args(
}
NameClass N=new NameClass)(;
N.i=10;
N.shwo)(;
}
}
constructer
Main
N
iClassName10
show()ClassName
ConstructorConstructorConstructor
class A}
int x=10;
int y=10;
public A)(
}
System.out.println)"x+y="+)x+y((;
}
public static void main)String][ args( }
new A)(;
}
}
x+y=20
class mohammed{
int x;
int y;
String h;
public mohammed()
{
System.out.println("class
name:mohammed");
}
void mo(int i)
{
System.out.println("x="+x);
System.out.println("y="+y);
System.out.println("s="+h);
System.out.println("i="+i);
}
public static void main(String[] args) {
mohammed m=new mohammed();
m.x=20;
m.y=30;
m.h="mohammed dawod";
m.mo(10);
}
}
class name:mohammed
x=20
y=30
s=mohammed dawod
i=10
Output
class mohammed{
public mohammed()
{
System.out.println("class
name:mohammed");
}
void mo(int i,int m)
{
System.out.println("i+m="+(i+m));
}}
class dawod{
public dawod(){
System.out.println("class name:dawod");
}
public void sum(int i,int j){
System.out.println("i+j="+(i+j));
}
public static void main(String[] args) {
mohammed m=new mohammed();
m.mo(10,20);
dawod d=new dawod();
d.sum(50,100);
}
}
class name:mohammed
i+m=30
class name:dawod
i+j=150
Output
class dawod{
public dawod(int x,String
s){
System.out.println(x+"
"+s);
}
public static void
main(String[] args) {
new dawod(10,"mohammed");
}
}
10mohammed
Output
Inheritance
OOP.
inheritance)
•classclass
•classSubClassclassSuperClass.
•extends
•final.
•classsubclassClasssuperClassprivatefinal
•ClasssuperClass
•inheritance
inheritance:
class A{
int x,y;
public void num()
{
System.out.println("x+y="+(x+y));
}
} class B extends A{
}
class run{
public static void main(String[] args)
{
A aa=new A();
B bb=new B();
bb.x=10;
bb.y=20;
bb.num();
} }
•BA
xyB.
B
AB
class A{
int x,y;
public void num()
{
System.out.println("x+y="+(x+y));
}
} class B extends A{
}
class run{
public static void main(String[] args)
{
A aa=new A();
B bb=new B();
bb.x=10;
bb.y=20;
bb.num();
} }
staticbody
objectA
num()
objectB
B
class B{
int x,y;
public void num()
}
System.out.println("x+y="+x+y);
{
x+y=30
class nabil{
int x=10;
int y=20;
void show()
{
System.out.println("x="+x+"n"+"y="+y);
}
}
class dawod extends nabil{
public dawod(){
++x;
--y;
}
public static void main(String[] args) {
dawod d=new dawod();
d.show();
}
}
x=11
y=19
Output
Polymorphism
1.Overloading
2.Overriding
3.Abstract
Overloading
sumsum(int xsum(char x
sum(int i, duoble x
sum(int x. (
sum(char x(
sum(int x,duoble x
Overloading
class overload}
void sum(int x)}
System.out.println("x:"+x);
}
void sum(char x)
}
System.out.println("x:"+x);
}
void sum(int i,double x)
}
System.out.println("i:"+i+"&"+"x:"+x);
}
public static void main(String[] args) }
overload oo=new overload();
oo.sum(10);
oo.sum('m');
oo.sum(10,10.5);
}}
x:10
x:m
i:10&x:10.5
Overriding:
Overriding
ABsum(int x,int yBsum(int x,int yBABAclass B extends A
BA
sum(int x,int yBBABoverriding.
overridingBAoverridingoverriding.
overriding
class A}
void sum(int x,int y)}
System.out.println("in class A: x+y="+(x+y));
}
}
class B extends A}
void sum(int x,int y)}
System.out.println("in class B: x+y="+(x+y));
}
public static void main(String[] args) }
B oo=new B();
oo.sum(10,20);
}
}
in class B: x+y=30
Boverriding(
overriding
Write java program that use overriding method in two classes one of them is A and the other is B
inhrites A ? (use two methods)
•
•
•
Design interface
(GUI(
swingawtbutton
Imoprt javax.swing.JButton;
labeltextfiledmenubar
Import javax.swing.*;
Buttonlabeltextfiled
•Jpanal
•JLabel
•JTextFiled
•JButton
import javax.swing.*;
class mohammed extends JPanel}
JLabel j1,j2;
JTextField t1,t2;
JButton b1;
public mohammed((}
setLayout(null(;
j1=new JLabel("Name"(;
j1.setBounds(10,20,40,25(;
add(j1(;
t1=new JTextField((;
t1.setBounds(60,20,200,25(;
add(t1(;
j2=new JLabel("ID"(;
j2.setBounds(20,50,40,25(;
add(j2(;
t2=new JTextField((;
t2.setBounds(60,50,25,25(;
add(t2(;
b1=new JButton("ok"(;
b1.setBounds(110,100,80,30(;
add(b1(;
}
public static void main(String[] avgs(
}
mohammed m=new mohammed((;
JFrame f=new JFrame("fffffff"(;
f.setVisible(true(;
f.setSize(300,250(;
f.setContentPane(m(;
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE(;
}
}
import javax.swing.*;
class mohammed extends JPanel}
JLabel j1,j2;
JTextField t1,t2;
JButton b1;
JPanel
public mohammed((}
setLayout(null(;
j1=new JLabel("Name"(;
j1.setBounds(10,20,40,25(;
add(j1(;
t1=new JTextField((;
t1.setBounds(60,20,200,25(;
add(t1(;
j2=new JLabel("ID"(;
j2.setBounds(20,50,40,25(;
add(j2(;
t2=new JTextField((;
t2.setBounds(60,50,25,25(;
add(t2(;
b1=new JButton("ok"(;
b1.setBounds(110,100,80,30(;
add(b1(;
}
labelname
Name
labelpanel
j1.setBounds(10,20,40,25(;
(0,0(
(10,20(
40
25
labelpanel
ID
ok
ID
ok
name
public static void main(String[] avgs(
}
mohammed m=new mohammed((;
JFrame f=new JFrame("fffffff"(;
f.setVisible(true(;
f.setSize(300,250(;
f.setContentPane(m(;
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE(;
}
}
mohammed
f.setSize(width,height(;
JMenuBar
JMenu
JMenuItem
copy toeditjmenufileJMenuItem
JMenuJMenuItem
import javax.swing.*;
class TestMenu extends JPanel}
JMenuBar mbr;
JMenu file,edit,Copy;
JMenuItem New,Open,Exit,c,d,e;
public TestMenu((}
setLayout(null(;
mbr=new JMenuBar((;
file=new JMenu("file"(;
edit=new JMenu("Edit"(;
Copy=new JMenu("Copy TO"(;
New=new JMenuItem("new"(;
Open=new JMenuItem("Open"(;
Exit=new JMenuItem("Exit"(;
c=new JMenuItem("C:/"(;
d=new JMenuItem("D:/"(;
e=new JMenuItem("E:/"(;
file.add(New(;
file.add(Open(;
file.add(Exit(;
Copy.add(c(;
Copy.add(d(;
Copy.add(e(;
edit.add(Copy(;
mbr.add(file(;
mbr.add(edit(;
add(mbr(;
mbr.setBounds(0,0,200,30(;
}
public static void main(String args[](
}
JFrame fr=new JFrame("mohammed"(;
TestMenu td=new TestMenu((;
fr.setContentPane(td(;
fr.setVisible(true(;
fr.setSize(200,200(;
fr.setDefaultCloseOperation(3(;
}
}
Panel
JTabbedPane
2JPanel
2JLabel
import java.awt.Container;
import javax.swing.*;
class Tab extends JFrame}
JLabel Lname,Lme;
JPanel jp1,jp2;
JTabbedPane tab;
Tab)(}
super)"Tap"(;
Container co=getContentPane)(;
Lname=new JLabel)"mohammed"(;
Lme=new JLabel)"yemen"(;
jp1=new JPanel)(;
jp2=new JPanel)(;
tab=new JTabbedPane)(;
jp1.add)Lname(;
jp2.add)Lme(;
tab.add)"Tab1",jp1(;
tab.add)"Tab2",jp2(;
co.add)tab(;
setSize)300,150(;
setVisible)true(;
}
public static void main)String[] args( }
Tab t=new Tab)(;
t.setDefaultCloseOperation)JFrame.EXIT_ON_CLOSE(;
}
}
import javax.swing.*;
class Tab extends JFrame}
JLabel Lname,Lme;
JPanel jp1,jp2;
JTabbedPane tab;
Tab)(}
super)"Tap"(;
Container co=getContentPane)(;
Lname=new JLabel)"mohammed"(;
Lme=new JLabel)"yemen"(;
jp1=new JPanel)(;
jp2=new JPanel)(;
tab=new JTabbedPane)(;
jp1.add)Lname(;
jp2.add)Lme(;
tab.add)"Tab1",jp1(;
tab.add)"Tab2",jp2(;
co.add)tab(;
setSize)300,150(;
setVisible)true(;
}
JFrame
public static void main)String[] args( }
Tab t=new Tab)(;
t.setDefaultCloseOperation)JFrame.EXIT_ON_CLOSE(;
{
{
Design interface )GUIGUIJCheckBoxJComboBox
OOP
OOP
•EVENT HANDLING
•STREEM
•
–

More Related Content

What's hot

The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 41 of 210
The Ring programming language version 1.9 book - Part 41 of 210The Ring programming language version 1.9 book - Part 41 of 210
The Ring programming language version 1.9 book - Part 41 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180Mahmoud Samir Fayed
 
C++ Returning Objects
C++ Returning ObjectsC++ Returning Objects
C++ Returning ObjectsJay Patel
 
OOP with Java - continued
OOP with Java - continuedOOP with Java - continued
OOP with Java - continuedRatnaJava
 
The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 6 of 31
The Ring programming language version 1.5 book - Part 6 of 31The Ring programming language version 1.5 book - Part 6 of 31
The Ring programming language version 1.5 book - Part 6 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 36 of 196
The Ring programming language version 1.7 book - Part 36 of 196The Ring programming language version 1.7 book - Part 36 of 196
The Ring programming language version 1.7 book - Part 36 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 37 of 181
The Ring programming language version 1.5.2 book - Part 37 of 181The Ring programming language version 1.5.2 book - Part 37 of 181
The Ring programming language version 1.5.2 book - Part 37 of 181Mahmoud Samir Fayed
 
Object Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsObject Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsDudy Ali
 
The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 37 of 196
The Ring programming language version 1.7 book - Part 37 of 196The Ring programming language version 1.7 book - Part 37 of 196
The Ring programming language version 1.7 book - Part 37 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.10 book - Part 43 of 212The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.10 book - Part 43 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 22 of 88
The Ring programming language version 1.3 book - Part 22 of 88The Ring programming language version 1.3 book - Part 22 of 88
The Ring programming language version 1.3 book - Part 22 of 88Mahmoud Samir Fayed
 

What's hot (19)

The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31
 
The Ring programming language version 1.9 book - Part 41 of 210
The Ring programming language version 1.9 book - Part 41 of 210The Ring programming language version 1.9 book - Part 41 of 210
The Ring programming language version 1.9 book - Part 41 of 210
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180
 
Java Day-4
Java Day-4Java Day-4
Java Day-4
 
C++ Returning Objects
C++ Returning ObjectsC++ Returning Objects
C++ Returning Objects
 
OOP with Java - continued
OOP with Java - continuedOOP with Java - continued
OOP with Java - continued
 
The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180
 
Class method
Class methodClass method
Class method
 
The Ring programming language version 1.5 book - Part 6 of 31
The Ring programming language version 1.5 book - Part 6 of 31The Ring programming language version 1.5 book - Part 6 of 31
The Ring programming language version 1.5 book - Part 6 of 31
 
The Ring programming language version 1.7 book - Part 36 of 196
The Ring programming language version 1.7 book - Part 36 of 196The Ring programming language version 1.7 book - Part 36 of 196
The Ring programming language version 1.7 book - Part 36 of 196
 
The Ring programming language version 1.5.2 book - Part 37 of 181
The Ring programming language version 1.5.2 book - Part 37 of 181The Ring programming language version 1.5.2 book - Part 37 of 181
The Ring programming language version 1.5.2 book - Part 37 of 181
 
Object Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsObject Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & Destructors
 
The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196
 
The Ring programming language version 1.7 book - Part 37 of 196
The Ring programming language version 1.7 book - Part 37 of 196The Ring programming language version 1.7 book - Part 37 of 196
The Ring programming language version 1.7 book - Part 37 of 196
 
The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.10 book - Part 43 of 212The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.10 book - Part 43 of 212
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88
 
The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202
 
The Ring programming language version 1.3 book - Part 22 of 88
The Ring programming language version 1.3 book - Part 22 of 88The Ring programming language version 1.3 book - Part 22 of 88
The Ring programming language version 1.3 book - Part 22 of 88
 

Similar to Nabil code

Similar to Nabil code (20)

Java Programs
Java ProgramsJava Programs
Java Programs
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
Comp102 lec 7
Comp102   lec 7Comp102   lec 7
Comp102 lec 7
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Java Programs Lab File
Java Programs Lab FileJava Programs Lab File
Java Programs Lab File
 
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
 
Language fundamentals ocjp
Language fundamentals ocjpLanguage fundamentals ocjp
Language fundamentals ocjp
 
Python tour
Python tourPython tour
Python tour
 
Java practical
Java practicalJava practical
Java practical
 
Java 5 and 6 New Features
Java 5 and 6 New FeaturesJava 5 and 6 New Features
Java 5 and 6 New Features
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Java programs
Java programsJava programs
Java programs
 
Object oriented programming la bmanual jntu
Object oriented programming la bmanual jntuObject oriented programming la bmanual jntu
Object oriented programming la bmanual jntu
 
sample_midterm.pdf
sample_midterm.pdfsample_midterm.pdf
sample_midterm.pdf
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
 
Awt
AwtAwt
Awt
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
 
nested_Object as Parameter & Recursion_Later_commamd.pptx
nested_Object as Parameter  & Recursion_Later_commamd.pptxnested_Object as Parameter  & Recursion_Later_commamd.pptx
nested_Object as Parameter & Recursion_Later_commamd.pptx
 
Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]Lec 5 13_aug [compatibility mode]
Lec 5 13_aug [compatibility mode]
 
Java ppt Gandhi Ravi (gandhiri@gmail.com)
Java ppt  Gandhi Ravi  (gandhiri@gmail.com)Java ppt  Gandhi Ravi  (gandhiri@gmail.com)
Java ppt Gandhi Ravi (gandhiri@gmail.com)
 

More from nabildekess

More from nabildekess (19)

Scratch 2.0 offline
Scratch 2.0 offlineScratch 2.0 offline
Scratch 2.0 offline
 
Excel
ExcelExcel
Excel
 
Scratch
ScratchScratch
Scratch
 
La formation a distance
La formation a distanceLa formation a distance
La formation a distance
 
Examen organigrame
Examen organigrameExamen organigrame
Examen organigrame
 
E learning
E   learningE   learning
E learning
 
Nabil code
Nabil  codeNabil  code
Nabil code
 
Nabil code
Nabil  codeNabil  code
Nabil code
 
HVS,DMS
HVS,DMSHVS,DMS
HVS,DMS
 
Visioconference 2019-final
Visioconference 2019-finalVisioconference 2019-final
Visioconference 2019-final
 
Examen organigrame
Examen organigrameExamen organigrame
Examen organigrame
 
Hvs
HvsHvs
Hvs
 
Hvs
HvsHvs
Hvs
 
Examen organigrame
Examen organigrameExamen organigrame
Examen organigrame
 
La formation a distance
La formation a distanceLa formation a distance
La formation a distance
 
Visioconference 2019-final
Visioconference 2019-finalVisioconference 2019-final
Visioconference 2019-final
 
Hvs
HvsHvs
Hvs
 
Mooc
MoocMooc
Mooc
 
Nabil Scratch
Nabil ScratchNabil Scratch
Nabil Scratch
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Nabil code

  • 1. OOP Package import Imprt java.awt.*; Class Class nabil} Public nabil)( } } void AnyName)( } } Public static void main)String args][( } } } Constructornabilnabil nabil nnn=new nabil)(; mainstaticstatic.
  • 2. Java Structure Program: Package Name; Import Java Class; Public classes NameClasss } //declaver of variables int I; char c; Jlabel l1; . . . public void NameClass)( } System.out.println)""(; } Void show)( } System.out.println)"i="+i(; } public static void main)String][ args( } NameClass N=new NameClass)(; N.i=10; N.shwo)(; } } constructer Main N iClassName10 show()ClassName
  • 3. ConstructorConstructorConstructor class A} int x=10; int y=10; public A)( } System.out.println)"x+y="+)x+y((; } public static void main)String][ args( } new A)(; } } x+y=20
  • 4. class mohammed{ int x; int y; String h; public mohammed() { System.out.println("class name:mohammed"); } void mo(int i) { System.out.println("x="+x); System.out.println("y="+y); System.out.println("s="+h); System.out.println("i="+i); } public static void main(String[] args) { mohammed m=new mohammed(); m.x=20; m.y=30; m.h="mohammed dawod"; m.mo(10); } } class name:mohammed x=20 y=30 s=mohammed dawod i=10 Output
  • 5. class mohammed{ public mohammed() { System.out.println("class name:mohammed"); } void mo(int i,int m) { System.out.println("i+m="+(i+m)); }} class dawod{ public dawod(){ System.out.println("class name:dawod"); } public void sum(int i,int j){ System.out.println("i+j="+(i+j)); } public static void main(String[] args) { mohammed m=new mohammed(); m.mo(10,20); dawod d=new dawod(); d.sum(50,100); } } class name:mohammed i+m=30 class name:dawod i+j=150 Output
  • 6. class dawod{ public dawod(int x,String s){ System.out.println(x+" "+s); } public static void main(String[] args) { new dawod(10,"mohammed"); } } 10mohammed Output
  • 8. class A{ int x,y; public void num() { System.out.println("x+y="+(x+y)); } } class B extends A{ } class run{ public static void main(String[] args) { A aa=new A(); B bb=new B(); bb.x=10; bb.y=20; bb.num(); } } •BA
  • 9. xyB. B AB class A{ int x,y; public void num() { System.out.println("x+y="+(x+y)); } } class B extends A{ } class run{ public static void main(String[] args) { A aa=new A(); B bb=new B(); bb.x=10; bb.y=20; bb.num(); } } staticbody objectA num() objectB B class B{ int x,y; public void num() } System.out.println("x+y="+x+y); { x+y=30
  • 10. class nabil{ int x=10; int y=20; void show() { System.out.println("x="+x+"n"+"y="+y); } } class dawod extends nabil{ public dawod(){ ++x; --y; } public static void main(String[] args) { dawod d=new dawod(); d.show(); } } x=11 y=19 Output
  • 12. Overloading class overload} void sum(int x)} System.out.println("x:"+x); } void sum(char x) } System.out.println("x:"+x); } void sum(int i,double x) } System.out.println("i:"+i+"&"+"x:"+x); } public static void main(String[] args) } overload oo=new overload(); oo.sum(10); oo.sum('m'); oo.sum(10,10.5); }} x:10 x:m i:10&x:10.5
  • 13. Overriding: Overriding ABsum(int x,int yBsum(int x,int yBABAclass B extends A BA sum(int x,int yBBABoverriding. overridingBAoverridingoverriding. overriding
  • 14. class A} void sum(int x,int y)} System.out.println("in class A: x+y="+(x+y)); } } class B extends A} void sum(int x,int y)} System.out.println("in class B: x+y="+(x+y)); } public static void main(String[] args) } B oo=new B(); oo.sum(10,20); } } in class B: x+y=30 Boverriding( overriding Write java program that use overriding method in two classes one of them is A and the other is B inhrites A ? (use two methods)
  • 17. import javax.swing.*; class mohammed extends JPanel} JLabel j1,j2; JTextField t1,t2; JButton b1; public mohammed((} setLayout(null(; j1=new JLabel("Name"(; j1.setBounds(10,20,40,25(; add(j1(; t1=new JTextField((; t1.setBounds(60,20,200,25(; add(t1(; j2=new JLabel("ID"(; j2.setBounds(20,50,40,25(; add(j2(; t2=new JTextField((; t2.setBounds(60,50,25,25(; add(t2(; b1=new JButton("ok"(; b1.setBounds(110,100,80,30(; add(b1(; } public static void main(String[] avgs( } mohammed m=new mohammed((; JFrame f=new JFrame("fffffff"(; f.setVisible(true(; f.setSize(300,250(; f.setContentPane(m(; f.setDefaultCloseOperation(f.EXIT_ON_CLOSE(; } }
  • 18. import javax.swing.*; class mohammed extends JPanel} JLabel j1,j2; JTextField t1,t2; JButton b1; JPanel public mohammed((} setLayout(null(; j1=new JLabel("Name"(; j1.setBounds(10,20,40,25(; add(j1(; t1=new JTextField((; t1.setBounds(60,20,200,25(; add(t1(; j2=new JLabel("ID"(; j2.setBounds(20,50,40,25(; add(j2(; t2=new JTextField((; t2.setBounds(60,50,25,25(; add(t2(; b1=new JButton("ok"(; b1.setBounds(110,100,80,30(; add(b1(; } labelname Name labelpanel j1.setBounds(10,20,40,25(; (0,0( (10,20( 40 25 labelpanel ID ok
  • 19. ID ok name public static void main(String[] avgs( } mohammed m=new mohammed((; JFrame f=new JFrame("fffffff"(; f.setVisible(true(; f.setSize(300,250(; f.setContentPane(m(; f.setDefaultCloseOperation(f.EXIT_ON_CLOSE(; } } mohammed f.setSize(width,height(;
  • 21. import javax.swing.*; class TestMenu extends JPanel} JMenuBar mbr; JMenu file,edit,Copy; JMenuItem New,Open,Exit,c,d,e; public TestMenu((} setLayout(null(; mbr=new JMenuBar((; file=new JMenu("file"(; edit=new JMenu("Edit"(; Copy=new JMenu("Copy TO"(; New=new JMenuItem("new"(; Open=new JMenuItem("Open"(; Exit=new JMenuItem("Exit"(; c=new JMenuItem("C:/"(; d=new JMenuItem("D:/"(; e=new JMenuItem("E:/"(; file.add(New(; file.add(Open(; file.add(Exit(; Copy.add(c(; Copy.add(d(; Copy.add(e(; edit.add(Copy(; mbr.add(file(; mbr.add(edit(; add(mbr(; mbr.setBounds(0,0,200,30(; } public static void main(String args[]( } JFrame fr=new JFrame("mohammed"(; TestMenu td=new TestMenu((; fr.setContentPane(td(; fr.setVisible(true(; fr.setSize(200,200(; fr.setDefaultCloseOperation(3(; } }
  • 23. import java.awt.Container; import javax.swing.*; class Tab extends JFrame} JLabel Lname,Lme; JPanel jp1,jp2; JTabbedPane tab; Tab)(} super)"Tap"(; Container co=getContentPane)(; Lname=new JLabel)"mohammed"(; Lme=new JLabel)"yemen"(; jp1=new JPanel)(; jp2=new JPanel)(; tab=new JTabbedPane)(; jp1.add)Lname(; jp2.add)Lme(; tab.add)"Tab1",jp1(; tab.add)"Tab2",jp2(; co.add)tab(; setSize)300,150(; setVisible)true(; } public static void main)String[] args( } Tab t=new Tab)(; t.setDefaultCloseOperation)JFrame.EXIT_ON_CLOSE(; } }
  • 24. import javax.swing.*; class Tab extends JFrame} JLabel Lname,Lme; JPanel jp1,jp2; JTabbedPane tab; Tab)(} super)"Tap"(; Container co=getContentPane)(; Lname=new JLabel)"mohammed"(; Lme=new JLabel)"yemen"(; jp1=new JPanel)(; jp2=new JPanel)(; tab=new JTabbedPane)(; jp1.add)Lname(; jp2.add)Lme(; tab.add)"Tab1",jp1(; tab.add)"Tab2",jp2(; co.add)tab(; setSize)300,150(; setVisible)true(; } JFrame
  • 25. public static void main)String[] args( } Tab t=new Tab)(; t.setDefaultCloseOperation)JFrame.EXIT_ON_CLOSE(; { { Design interface )GUIGUIJCheckBoxJComboBox