Lecture 1
Lecture 1
Lecture 1
E. Cho Smith
CIT 255
[email protected]
2
JAVA MOTIVATIONS
➢ Simple
➢Object Oriented
➢Distributed
➢Robust
➢Secure
➢Architecture-Neutral
➢Portable
➢Interpreted (originally)
➢High Performance
➢Multithreaded
➢Dynamic
3 3
BASIC IDEAS
➢ Flashback to 1995.
➢Browsers were new and served static web pages.
➢Java applets made them alive.
➢Applet code is downloaded from the internet.
➢Runs safely in the “sandbox”.
4 4
BASIC IDEAS
➢ Unfortunately,
the initial excitement turned into frustration.
➢ Netscape and Internet Explorer used different Java versions.
➢ Flash provided dynamic effects in browsers.
➢ Sun and Oracle were slow to react to security breaches.
5 5
FIRST PROGRAM
6 6
FIRST PROGRAM
7 7
FIRST PROGRAM
8 8
FIRST PROGRAM
}
➢ To compile: javac MyFirstProgram.java
➢ Will produce: MyFirstProgram.class
9 9
FIRST PROGRAM
public class MyFirstProgram
{
public static void main(String [ ] args)
{
System.out.println(“hello world ”);
// most simple class that produces some output
}
}
➢ To compile: javac MyFirstProgram.java
➢ Will produce: MyFirstProgram.class
➢ To execute: java MyFirstProgram
➢ Will produce: > hello world
10 10
FIRST PROGRAM
public class MyFirstProgram
{
public static void main(String [ ] args)
{
System.out.println(“hello world ” + args[0]);
// most simple class that produces some output
}
}
➢ To compile: javac MyFirstProgram.java
➢ Will produce: MyFirstProgram.class
➢ To execute: java MyFirstProgram BoilerMakers CNIT255
➢ Will produce: > hello world BoilerMakers
11 11
EXERCISE
Please go ahead and do the Lecture 1
Exercise.
12 12
LECTURE 2 – VARIABLES/DATA
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
GOALS SIMPLE PROGRAM
COMMENTS
DATA TYPES
VARIABLES
OPERATORS
!
FIRST PROGRAM
!"#$%&'&$())'!"#$%&'(%)*%+,
*
!"#$%&')+(+%&',-%.'/(%012+3%04'5'6'(34)7
*
28)+9/:-"+:!3%0+$01;<9$$-'=-3$.>'?'(34)5@67A
BB'/-)+')%/!$9'&$())'+<(+'!3-."&9)')-/9'-"+!"+
C
C
! !"#$"%&'()*##+,-,$ ./0'12341"51,%6+,-,
! 7'((#&1"89$)*##./0'12341"51,%6$(,22
! !"#):)$93)*#+,-,#./0'12341"51,% ;"'()1.,<)12 =>!?@@
! 7'((#&1"89$)*#A#B)(("#C"1(8#;"'()1.,<)12
" "
COMMENTS
!"##$%&#'()#*&+#!"#$%&$#''()*+&(),-./0/#1)#+./#*0%20(3
4),+.1)2#1)#5/+-//)#-166#5/#'%33/)+7
"!
*&561'#'6(77#!"#$%&'(%)*%+,
8
*&561'#7+(+1'#9%1:#3(1);<+01)2#=#>#(027?
8
!!,)&"-)(&'%33/)+7
!!#
@
# #
DATA TYPES
! D-"3'%0+9493'+8!9)E
!%0+ 1F'#8+9)7'1GHIJFKIFLMINFL'+-'HIJFKIFLMINFK7
!)<-3+'1H'#8+9)7'1GMHIKNL'+-'MHIKNK7
!$-04'1L'#8+9)7'1GOIHHMIMKHI@MNILPFIKKPIL@L'+-'OIHHMIMKHI@MNILPFIKKPIL@K7
!#8+9'1J'#8+97'1GJHL'+-'JHK7
$ $
DATA TYPES
! Q=-'R$-(+%04G!-%0+'+8!9)E
!R$-(+'1F'#8+9)7'SM:F@HLHMFKT?MLD'1NGK')%40%R%&(0+'.9&%/($'.%4%+)7
!.-"#$9'1L'#8+9)7'SJ:KOKNOMJMFLNHMJPK@T?M@L'1JP')%40%R%&(0+'.9&%/($'.%4%+)7
% %
&
DATA TYPES
! -.+% +8!9E
! U)9.'+-'.9)&3%#9'U0%&-.9'&<(3(&+93)
! VWX'<()',($"9'NP
! 2-/9'&<(3(&+93)'!39&9.9.'#8'#(&Y)$()<
! Z0'1[9=$%097
! Z+'1Q(#7
' '
DATA TYPES
! /))01+2 +8!9E
! Q=-',($"9)E''%31I'4+0&1:
! [-'&-0,93)%-0'#9+=990'%0+ (0.'#--$9(0:
! \%RR9390+'R3-/']B]??
( (
VARIABLES
!"#$%&'&$())'\9R%092-/9^(3%(#$9)
*
.-"#$9')($(38A
%0+ ,(&(+%-0\(8) _'JHA
$-04'9(3+<`-!"$(+%-0
#--$9(0 .-09A
C
)* )*
CONSTANTS
!"#$%&'&$())'\9R%092-/9]-0)+(0+)
*
BB&-0)+(0+)
R%0($ .-"#$9')($(38'_'J@@@@A''BB&(0'#9'($$'"!!93'&()9
R%0($'%0+ ,(&(+%-0\(8) _'J@A
C
)) ))
OPERATORS
! W3%+</9+%&E'?I'G I'aI'B
!b0+9493'.%,%)%-0'(0.'/-."$")E'B'(0.'c'1=%+<'%0+9493'-!93(0.)7E
! JP'B'H'%)'K
! JP'c'H'%)'J
! JP:@'B'H'%)'K:P
!d(+<:)e3+1f7'%)'56
!d(+<:!-=1(I'#7'%)'+!
)! )!
OPERATORS
!Q8!9']-0,93)%-0)
! W"+-/(+%&'&-0,93)%-0)
! \-++9.'$%09)E'!-))%#$9'!39&%)%-0'$-))
![-0GW"+-/(+%&']()9
! ]()+%04E
! .-"#$9'f'_'O:OOKA
! %0+ 0f _'1%0+7'fA
! %0+ 3f _'1%0+7'd(+<:3-"0.1f7A
)" )"
OPERATORS
!]-/#%0%04'())%40/90+'=%+<'-!93(+-3)E
! 0'?_'FA'BB')(/9'()'0'_'0'?'F
! W$)-'G_I'a_I'B_I'c_I'(0.')-'-0:
!b0&39/90+I'.9&39/90+E
! 0??A
! 0GGA
!g9$(+%-0($'-!93(+-3)E'__I'h_I'iI'i_I'jI'j_
!#--$9(0 -!93(+-3)E'kkI'llI'h
)# )#
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
)$ )$
LECTURE 3 – STRINGS
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
GOALS STRINGS
SUBSTRINGS
CONCATENATION
OPERATIONS
!
STRINGS
!!"#$%&'()#*('*+,*%-*'(./(0%$-.1*(-2)#)-"*#'
! !"#$%&(3$"*#)3'()#*(*%-3.'*1($%(1.,43*(+,."*'5(67*33.(8.#319
!!"#$%&'()#*(+,-*."':
! ;.,(-)%()33(<*"2.1'(.%('"#$%&':
! !"#$%&(&#**"$%&(=(67*33.9>
! !"#$%&('(=(&#**"$%&:',4'"#$%&?@A(BC>
! D.'$"$.%'('")#"()"(@:
! E)'"(F.'$"$.%($'(!"#$%&!&G':',4'"#$%&?)A(4C(2)'(3*%&"2(4(H ):
" "
STRINGS
!I.%-)"*%)"$.%(?JC(K.$%'('"#$%&'5
! !"#$%&(*LF3*"$M*(=(6NLF3*"$M*9>
! !"#$%&(DOPB(=(61*3*"*19>
! !"#$%&(<*'')&*(=(*LF3*"$M*(J(DOPB>
!Q/(.%*(.F*#)%1($'(%."()('"#$%&A($"($'(",#%*1($%".()('"#$%&5
! $%" )&*(=(PB>
! !"#$%&(#)"$%&(=(6DO9(J()&*>
# #
STRINGS
!!"#$%&'()#*($<<,")43*
! ;.,(-)%%."(-2)%&*()('"#$%&
! &#**"$%&:',4'"#$%&?@ABC(1.*'%R"(-2)%&*("2*(.#$&$%)3('"#$%&
! &#**"$%&(J(6S9(1.*'%R"(-2)%&*("2*(.#$&$%)3('"#$%&
!/+(%+"(0'*(11("+(.+23)#*('"#$%&'
! T3U)V'(,'*(!'%($)
! 67*33.9:*+,)3'?&#**"$%&C
!N<F"V('"#$%&(69(2)'(3*%&"2(@:
!%,33($%1$-)"*'(%.('"#$%&()"()33:
$ $
THE STRING API
!W)%V(."2*#(,'*/,3(!"#$%& <*"2.1':
!"#$' V$*31'()(%*U('"#$%&A("#$<<$%&(3*)1$%&()%1("#)$3$%&(U2$"*('F)-*:
!"()(*+#,-.+ V$*31'()(%*U('"#$%&("2)"(-.%M*#"'()33(,FF*#-)'*(-2)#)-"*#'(
".(3.U*#-)'*:
!$%/+012A(3-."4%/+012 /$%1'("2*(3.-)"$.%(./()(',4'"#$%&:
!I2*-X(.,"("2*(.%3$%*(TDQ(1.-,<*%")"$.%S
% %
ONLINE API
& &
ONLINE API
' '
ONLINE API
( (
ONLINE API
)* )*
ONLINE API
)) ))
ONLINE API
)! )!
ONLINE API
)" )"
LAB 1
45)"(6+0788(%**9("+(9+:
! Y*)1($%F,"(/#.<(,'*#(?U$1"2A(2*$&2"A(*"-:C
! D*#/.#<(-)3-,3)"$.%'(?M.3,<*(-)3-,3)"$.%C
! D#$%"(#*',3"'(?M.3,<*A(&)33.%'A(-.'"C
)# )#
LAB 1
!;*8*"+%(3#+&#)2(6+0()#*(3#+<$9*9:
!"#$%&'()*)+,&!-+./
!"#$%&'()*)+&01&+2,"30%4$%")&/
55'6'7)"#-0'!8#,&5$,&#,&'019:)8;0'<$%')'9$%%09&-='9$"#-0&0>'*0%7!$8'$<
55'&:!7'#%$;%)"'!7'-!7&0>')7')'70#)%)&0')&&)9:"08&+
#,3-!9'9-)77'4$,8&)!8?)3
@
#,3-!9'7&)&!9'*$!>'")!8AB&%!8;')%;7CDE
@
55'F%0)&0')'B9)880%'&$'%0)>'<%$"',70%'!8#,&
B9)880%'!8'G'80H'B9)880%AB=7&0"+!8E/
55'IJKJ'L )7M'<$%'0)9:'$<'Y%)>!,7YZ'YH!>&:[YZ'YH!>&:\YZ'Y>0#&:Y+
55']0"0"30%'&$'M00#')7M!8;'!<'&:0'*)-,0'!7'$,&'$<'%)8;0Z')8>'&$
55'&0--'&:0',70%'&:)&'&:0=^*0'08&0%0>')8'!8*)-!>'*)-,0+
55'IJKJ'L #%!8&'&:0'9)-9,-)&0>'7&)&!7&!97'7#09!<!0>'!8
55'U_:)&'I$'K$Z'68>'`$HU
55'a$,'9)8'#%!8&'>$--)%')"$,8&7'H!&:'&:0'<$--$H!8;'9$>0+''2$&0'&:)&
55'!<'=$,'(,7&'#%!8&')'>$,3-0Z'!&'")='8$&'#%!8&'&H$'>09!")-'#-)907
55'H$%&:'$<'#088!07''A0+;+'Ubc+cOU'H$,->')##0)%')7'Ubc+cUE+
>$,3-0'9$7&'G'O+O/
B=7&0"+$,&+#%!8&-8AUI:)&')"$,8&'$<'H)&0%'H!--'9$7&W'U'd
2,"30%4$%")&+;0&F,%%089=e87&)890AE+<$%")&A9$7&EE/
X
X
)$ )$
LAB 1
=++8'(6+0788(%**9("+(9+("5*(8),
! E..F'(?#*F*)"*13V()'X("2*(,'*#(/.#($%F,"(/.#(*)-2(M)3,*C
! !-)%%*#(?,'*($%:%*L"Z.,43*?C(".(#*)1()(1.,43*(/#.<(-.%'.3*C
! T#$"2<*"$-(?-)3-,3)"$%&(M.3,<*A(*"-:C
)% )%
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
)& )&
LECTURE 4 – CONTROL FLOW
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
GOALS DECISIONS
LOOPS
MULTIPLE SELECTIONS
CONTROL BREAKS
!
DECISIONS
!!" !"#"$%$&"
! !"#$%&'()*+,- ./#0#1#2*(3,24
5
6,("&(7*89,#/#:;<9,++,82=>
?&8'-#/#@AAA>
B
,+-,#!"#$%&'()*+,- ./#@CD#1#2*(3,24
5
6,("&(7*89,#/#:E!8,=>
?&8'-#/#DAA>
B
,+-,#!"#$%&'()*+,- ./#2*(3,24
5
6,("&(7*89,#/#:)*2!-"*92&(%=>
?&8'-#/#@AA>
B
,+-,
5
)%-2,7C&'2C6(!82+8$:F&'G(,#"!(,H=4>
B
" "
LOOPS
!!"#$% !"#"$%$&"
! !"#$%&'()$)*+%&,&-.)$/&
0&
()$)*+%&12&3)45%*67
8.9($%&#*6%:%;6&2&()$)*+%&<&#*6%:%;6=)6% >&?@@7
()$)*+%&12&#*6%:%;67
4%):;117
A
B4;6%5C.96C3:#*6$*'4%):;&1&D&4%):;CD/7
# #
LOOPS
!&'(!"#$%)!"#"$%$&"
! 8.&
0&
()$)*+%&12&3)45%*67
8.9($%&#*6%:%;6&2&()$)*+%&<&#*6%:%;6=)6% >&?@@7
()$)*+%&12&#*6%:%;67
4%):;117
>>&3:#*6&+9::%*6&()$)*+%
C&C&C
>>&);E&#F&:%)84&6.&:%6#:%&)*8&-%6&#*396
C&C&C
A
!"#$%&'#*396C%G9)$;'HIJ//7
$ $
LOOPS
!*'+)!"#"$%$&"
! F.:&'#*6 # 2&?7&# ,2&?@7/&
B4;6%5C.96C3:#*6$*'#/7
% %
SWITCH
!,!#-.")!"#"$%$&"
! !"#$$%&'($')'$%*'!"#$$%&+!,-.%/0($12
!,-.%/034.05&($.+6!%7%".(3$'#$'35.(3$'+89':9';9'<1'=12
($. ">3("%')'($0$%?.@$.+12
-*(.">'+">3("%1
A
"#-%'8B
0'0'0
C&%#D2
"#-%':B
0'0'0
C&%#D2
"#-%';B
0'0'0
C&%#D2
"#-%'<B
0'0'0
C&%#D2
E%F#47.B
GG'C#E'($54.
0'0'0
C&%#D2
H
& &
BREAK
!/+%01)!"#"$%$&"
! !"#$%&'()*'(+'$',((-.
! !"#$%&'4%):;&,2&?@@/
0
()$)*+%&12&3)45%*67
8.9($%&#*6%:%;6&2&()$)*+%&<&#*6%:%;6=)6% >&?@@7
()$)*+%&12&#*6%:%;67
#F&'()$)*+%&K2&-.)$/&(:%)E7
4%):;117
A
! /$0'$,1$2&'"#-,$3#'!"#$% 42'-,$3506'*7#'"#8$509#"'50&59#'&' $09'$99506'
$0(*7#"'*#"850$*5(0'3(095*5(0.
! !"#$%&'4%):;&,2&?@@&LL&()$)*+%&,&-.)$/
0
()$)*+%&12&3)45%*67
8.9($%&#*6%:%;6&2&()$)*+%&<&#*6%:%;6=)6% >&?@@7
()$)*+%&12&#*6%:%;67
#F&'()$)*+%&,&-.)$/
4%):;117
A
' '
CONTINUE
!.'2-#23%)!"#"$%$&"
! /(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>'`$HU
55'a$,'9)8'#%!8&'>$--)%')"$,8&7'H!&:'&:0'<$--$H!8;'9$>0+''2$&0'&:)&
55'!<'=$,'(,7&'#%!8&')'>$,3-0Z'!&'")='8$&'#%!8&'&H$'>09!")-'#-)907
55'H$%&:'$<'#088!07''A0+;+'Ubc+cOU'H$,->')##0)%')7'Ubc+cUE+
>$,3-0'9$7&'G'O+O/
B=7&0"+$,&+#%!8&-8AUI:)&')"$,8&'$<'H)&0%'H!--'9$7&W'U'd
2,"30%4$%")&+;0&F,%%089=e87&)890AE+<$%")&A9$7&EE/
X
X
)) ))
LAB 1
7++.8)*+,-..)&$$/)"+)/+)"($).#9
! ;--(/%0,"("#*"$9<%#/=%*2"%)/",%+-,%&'()*%+-,%"#52%:#9)"7
! >5#''",%0)/"%&'6'"?*@-)A9"07%*-%,"#$%#%$-)A9"%+,-.%5-'/-9"7
! B,&*2."*&5%05#95)9#*&'4%:-9)."3%"*567
)! )!
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
)" )"
LECTURE 5 – ARRAYS
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
GOALS ARRAYS
INITIALIZATION
COPYING
MULTIDIMENSIONAL ARRAYS
!
ARRAYS
!!"#$%&!"#$%#$&&$'#()#!%*+,+&"-
!.&&$'#/$&!$01+#2+31$&$*!(%4
! !"#$%&'(
!5+6#(7+&$*(&+$*+"#$&&$'4
! !"#$%&'&)&"*+&!"#$,--%(
!.&&$'#!%2+8+"#$&+#)&(9#- *(#'./*"0#1 2 ,-
!:"+#$% *(#$33+""#+1+9+%*"4
! 345&6!"# ! )&-(&! 7&'./*"0#1(&!889
:;<#*=.4>#.?5!"#/"6'$!%9(
!;&#<"+#*=+#>)(&#+$3=?#1((74
! 345&6!"# */*=*"#&@&'9
:;<#*=.4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#$&&$'#/$&!$01+"#'!+12"#*6(#&+)+&+%3+"#*(#*=+#"$9+#$&&$'4
! ,6+AB"/*$--&',*0/ D">"I5"K5"E5"J5"HH5"HK"PF
,6+AB"-.4T8U.*;0'/ D"/*$--&',*0/F
-.4T8U.*;0'/AEB"D"HIF"!!"6(2"/*$--&',*0/AEB",/"$-/("HI
!:"+#I55';<.J4?;K3 *(#9$B+#$#*&<+#3(7'4
! !"#$%&'()!*+,-'./0-12*34 5&6337/48'()/9:;<-'./0-12*34=&<-'./0-12*348<*">#?@A
'( '(
MULTIDIMENSIONAL ARRAYS
!!"#$%$%&!"#$%#$&&$'#()#$&&$'"#(&#$#*6(C2!9+%"!(%$1#$&&$'4
! ,6+ABAB"*$),4@V.$'0 D
>
>HW5"K5"I5"HKP5
>E5"HG5"HH5"XP5
>Y5"W5"J5"HIP5
>L5"HE5"HL5"HP
PF
!D!*=(<*#!%!*!$1!@+&4
! ,6+ABAB"*$),4@V.$'0 D"602",6+AZ[\@BA][^_`U@BF
!:"+#*6(#!%2+8+"#*(#$33+""#+1+9+%*4#='0!J:L>'5*$,%$C% !"#,,-
'' ''
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
'" '"
LECTURE 6 – CLASSES PART 1
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
GOALS WHY OBJECT-ORIENTED?
CLASSES/OBJECTS
USING CLASSES
DEFINING YOUR OWN CLASS
ENCAPSULATION
!
WHY OOP?
!!"#$%&'()*+,-*,+./0'1+23+4556738
! 9:32+6*;5%'<'=4*4')*+,-*,+.%'>'?+23+45%8
! ?+2-./,+.%'21.+4*.'27'%;4+./'/4*48
!!"@$%&'ABC.-*D2+6.7*./'1+23+4556738
! E4-;'2BC.-*';4%'/4*4'47/'5.*;2/%8
! E7-41%,:4*627&'A7:F'5.*;2/%'-47'4--.%%'2BC.-*'/4*48
!G4H4'6%'*;2+2,3;:F'2BC.-*D2+6.7*./8
! EH.+F*;673'2*;.+'*;47'4'1+656*6H.'*F1.'H4:,.'6%'47'2BC.-*8
" "
CLASSES/OBJECTS
!I:4%%&'(I22J6.'-,**.+0'K2+'2BC.-*%
!=.%-+6B.%'2BC.-*'/4*4'47/'5.*;2/'B.;4H62+8
!ABC.-*'>'!"#$%"&'(2K'-:4%%8
!ABC.-*';4%&
! L.;4H62+
! )*4*.
! M/.7*6*F
!AA?'%*4+*%'N6*;'6/.7*6KF673'-:4%%.%&
! O2,7%'4+.'2K*.7'-:4%%.%&'!"#$P'%&'#&P'47/'%2'278
! Q.+B%'4+.'2K*.7'5.*;2/%&'('' 47'6*.5'*2'47'2+/.+P')*+, 47'2+/.+8
# #
USING CLASSES
!-("* 6%'47'4*F16-4:'-:4%%8'R2,'/27S*'54J.'2BC.-*%'*2'-4::'-("*.)/&"0128
!9%%,5.'*;4*'F2,';4H.'4'34+5" -:4%%8
! 1,B:6-'-:4%%'?267*'T
UU'/.K67.%'-:4%%'?267*
8'8'8
V
!I27%*+,-*'67%*47-.'N6*;'7.N&
! 34+5"64&+7+5%5# 865#9634+5"0:;<6=>2?
!O2N'F2,'-47'-4::'5.*;2/%&
! 4&+7+5%5#.7#"@02
!""#$%&&'()$*(+,)-.*)(/&0,1,$.&"2"(+3,-&0,1,&0,1,44&(50.)")+.,"3(6*!"/-
$ $
USING CLASSES
!97'2BC.-*'H4+64B:.';2:/%'4')'*')'"&' *2'47'2BC.-*8
!I21F673'4'H4+64B:.'54J.%'4'-21F'2K'*;.'+.K.+.7-.&
! 4&+7+5A94 864&+7+5%5#?
!9'5BCC +.K.+.7-.'+.K.+%'*2'72'2BC.-*&
! 4&+7+5A94 865BCC?
!I4,*627&'=27S*'-4::'4'5.*;2/'27'7,::8
! +D04&+7+5A94 E865BCC2
+ 864&+7+5A94.7#"@02?
% %
DEFINING YOUR OWN CLASS
!!"#$$%&'(")*++
,
--%./+"0$
(1/2#3+%431/56%5#'+7
(1/2#3+%0)89"+%$#"#1*7
(1/2#3+%:)!#";#3+ </1+;#*7
--%=)5$318!3)1$
(89"/!%&'(")*++>431/56%5?%0)89"+%$?%/53 *+#1?%/53 ')53<?%/53 0#*@
,
5#'+%A%57
$#"#1*%A%$7
</1+;#* A%:)!#";#3+B)C>*+#1?%')53<?%0#*@7
D
--%E+3<)0$
(89"/!%431/56%6+3F#'+>@%,%1+3815%5#'+7%D
B%B%B
D
& &
DEFINING YOUR OWN CLASS
!M7'3.7.+4:P'67%*47-.'K6.:/%'4+.'1+6H4*.8
!M76*64:6W./'67'-27%*+,-*2+&
! (89"/!%&'(")*++>431/56%5?%0)89"+%$?%/53 *+#1?%/53 ')53<?%/53 0#*@
,
5#'+%A%57
$#"#1*%A%$7
</1+;#* A%:)!#";#3+B)C>*+#1?%')53<?%0#*@7
D
!X;.'-4::&
! 5#96F$,C4G##0HI($#)6J45'K<6LMMMMM<6L=NM<6L<6L2
! %.*%'*;.'K6.:/%'4%'K2::2N%&
! 5($#686HI($#)6J45'K?
)(C(&G686LMMMMM?
*+&#O(G 86P4Q(CO("#.4D0L=NM<6L<6L2?
!O45.'2K'-27%*+,-*2+'>'-:4%%'745.8
!I27%*+,-*2+'27:F'N2+J%'N6*;'5#98
' '
DEFINING YOUR OWN CLASS
!!"#$%&''()*"+',--.(/()'0(!"#$%&''1234"'5(6%)789(:-----9(:;<-9(:9(:=
!Y.*;2/%'4--.%%'47/'52/6KF'K6.:/%&
! ,BRC+Q6S4+'6&(+)#T(C(&G0'4BRC#6RG3#&Q#5"2
U
'4BRC#6&(+)#686)(C(&G V6RG3#&Q#5" W6LMM?
)(C(&G X86&(+)#?
Y
!M7'*;.'-4::'5B$R#&MMZ.&(+)#T(C(&G0N2&
! Z.'4+.'-4::673'*;.'&(+)#T(C(&G 5.*;2/'27'*;.'2BC.-*'5B$R#&MMZ
! X;.'%4:4+F'2K'*;.'5B$R#&MMZ 2BC.-*'N6::'B.'52/6K6./
( (
DEFINING YOUR OWN CLASS
! ,BRC+Q6S4+'6&(+)#T(C(&G0'4BRC#6RG3#&Q#5"2
U
'4BRC#6&(+)#686)(C(&G V6RG3#&Q#5" W6LMM?
)(C(&G X86&(+)#?
Y
!I47'21*6274::F',%.'"*+) *2'.[1:6-6*:F'/.72*.'*;.'-,++.7*'2BC.-*S%'H4+64B:.&
! ,BRC+Q6S4+'6&(+)#T(C(&G0'4BRC#6RG3#&Q#5"2
U
'4BRC#6&(+)#686"*+).)(C(&G V6RG3#&Q#5" W6LMM?
"*+).)(C(&G X86&(+)#?
Y
)* )*
ENCAPSULATION
!O2*.'*;.'1+6H4*.'K6.:/'47/'1,B:6-'5.*;2/&
! ,&+S("#6T"&+5765($#?
,BRC+Q6T"&+5767#"[($#026U6&#"B&565($#?6Y
!L.7.K6*'!&'X;.'K6.:/'6%'(+.4/D27:F08
!L.7.K6*'\&'X;.'67*.+74:'+.1+.%.7*4*627'-47'.H2:H.&
! #,>?4@'(A@,>)B(C>,5@D4"'E
#,>?4@'(A@,>)B($45@D4"'E
#*+$>F(A@,>)B(B'@D4"'1=(G(,'@*,)(C>,5@D4"' H(2(8(H($45@D4"'E(I
)) ))
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
)! )!
LECTURE 7 – CLASSES PART 2
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
FINAL AND STATIC FIELDS
STATIC METHODS
GOALS PARAMETER PASSING
!
FINAL AND STATIC FIELDS
!!"!"#$% #$%&'"()**+,"(-)*.%/
! &'"($)*+!"#$%+,)'"#-+#$.*/
!!"#$%&'( !"!"#$% +01%(,"()*"2,$&&"0%"34,),%'/
! !"#$%&'()#*%+(,&"#*-./#+0'" '$%+/%*23
!/4+#5(67!+18''9:(;('$%+/%*2(<(*'=(,&"#*-./#+0'"9:3(>(>(>(?
!/4+#5($1#0(-#$'@1+0,&%"9:(;('$%+/%*2>%!!'*09A@1+0(2&%"BC*D:3(?
!!"0)$)"1 #$%&'"%5$2,2"+*(%"6%7"(&)22/
! &'"($)*+0)$)"1+"#) #*2)34/+55+6#*+!"*%4+&*'+1%$00
&'"($)*+"#) "4/+55+6#*+!"*%4+&*'+678*1)
&97%"1+(6"4+0*)34:;+<+"4+=+#*2)34/+#*2)34>>/+?
!!"0)$)"1+!"#$% #$%&'"$2")"2-)7%'"(+*2,)*,/
! !"#$%&'&$())'*(+,
-
!"#$%&')+(+%&'.%/($'01"#$2'34'5'67898:;<=:6:>;?;6<6>9=@
AA'B&&2))%#$2'(/CD,2E2'()'*(+,734
7'7'7
F
" "
STATIC METHODS
!!"2,),$("3%,-+'"'+%2*8,"+6%7),%"+*"+01%(,29
!:5)36&%/"@$)AB&6C:$D+7; (+364,%2"!! ;$,-+4,"42$*.")"<),-"+01%(,9
!=*"+,-%7";+7'2>")"2,),$("3%,-+'"42%2"*+")A"09
!?,),$("3%,-+'2"()*"+*&@")((%22"2,),$("#$%&'2/
! &97%"1+0)$)"1+"#) -*)E*2)34:;
<
'*)9'#+#*2)34/+55+'*)9'#+0)$)"1+!"*%4
?
!?466&@"(&)22"*)3%";-%*"()&&$*.",-%"3%,-+'/
! "#) #+=+F.&%6G**B-*)E*2)34:;/
!A-%".$"# 3%,-+'"$2"2,),$("0%()42%"*+"+01%(,2"-)B%"0%%*"(+*2,74(,%'"
;-%*",-%"67+.7)3"2,)7,2
# #
PARAMETER PASSING
!C)&&"0@"B)&4%/"A-%"3%,-+'".%,2"(+6$%2"+#"
,-%")7.43%*,"B)&4%2
!!"3%,-+'"()**+,"(-)*.%",-%"(+*,%*,2"+#"
"!#$!%&'()6)22%'",+"$,
!:5)36&%/
! !/4+#5(2&%($1#0(&"#!+'E%+/'901/4+'(F:
;
F(<(G(H(F3
?
!=*",-%"#+&&+;$*."()&&>",-%"&*'1*#) B)7$)0&%"$2"
*+,)(-)*.%'/
! 4697%*+&*'1*#)+=+HI/
)'"&%*J$%9*:&*'1*#);/
$ $
PARAMETER PASSING
!!"3%,-+'"()*"34,),%"+01%(,2/
! &97%"1+0)$)"1+(6"4+)'"&%*,$%$'G:F.&%6G**+2;+55+C6'K0
<
2B'$"0*,$%$'G:LII;/
?
!=*",-%"#+&&+;$*."()&&>",-%"2)&)7@"$2"(-)*.%'/
! A$''G+=+#*C+F.&%6G**:B+B+B;/
)'"&%*,$%$'G:A$''G;/
% %
PARAMETER PASSING
!?+3%"6%+6&%"2)@/"D=*"E)B)>"*430%72")7%"6)22%'"0@"B)&4%")*'"+01%(,2"
)7%"6)22%'"0@"7%#%7%*(%9F
!A-),82"*+*2%*2%9"=*"E)B)>"%B%7@,-$*."$2"6)22%'"0@"B)&4%9
!G01%(,"#'-'#'*.'())7%"6)22%'"0@"B)&4%9
& &
LAB 2
)*"$+,&#-..+'//0+$&+0&(
! H*'%72,)*'",-%"%5$2,$*."2,)7,%7"(+'%"I-)7'JK
! =36&%3%*,")"2%7$%2"+#"?,7$*."#4*(,$+*2"I)&2+"-)7'JK"
' '
LAB 2
1'0/23$"'0+$*/+/4%3$%'5+3$"2$/2+6&0/
! <)$*"#4*(,$+*
!"#$%&'()*)%&'+,%-'.*%/01)2%/3'*23(456
7
1)2%/3')891)2%/3 :'1;<=;>1;=?@AB
:10,0'>0?$/%,"%@'AB /$CD
1&*//92'(':'/9C'1&*//9201D()9.E%/6B
#,,$9*/ 2"/':')2"9B E8$#%01FG,%>""F
-,
7
1D()9.E,")E!2%/)0FG/)92'H,..*/-I'F6B
H$'/%G8$#%01FG,
1)2%/3'$%/9':'(E/9J)K%/906B
1)2%/345'&,..*/-L,2-( :'$%/9E(!$%)0F'F6B !"1($#,%G8$#%01FG,%,"%'##'4%A'8$/%"1%8F'B$8
MM'N*/-$9'FO"%)F'(!9&%*$$DE
%P'0FO"%)FE9O"*$(0&,..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6D%M0>>%A$%#$,G#1$/6
(" ("
LAB 2
789./8/'$+"+3/2%/3+&:+;$2%'5+:#'6$%&'3
! N$&&"$*",-%"'$##%7%*,"#4*(,$+*"2,402
! ?+3%"-$*,2")7%"67+B$'%'"$*",-%"(+'%"(+33%*,2
! O%)'",-%"E)B)"?,7$*."!P=>"3)*@"42%#4&"#4*(,$+*2";$&&"-%&6"@+4"
IQ++.&%"D1)B)"2,7$*.")6$FK
! R$*,2
! =36&%3%*,"2%)7(-A%5, 42$*."$*'%5G#
! =36&%3%*,"7%3+B%A%5, 42$*."7%6&)(%!&&I,%5,>"SSK
! =36&%3%*,")''A%5, 42$*."240?,7$*. T",%5,"T"240?,7$*.
! =*,%.%796)72%=*, ;$&&"0%"42%#4&
! 7%B%72%A%5,/"H2%"?,7$*.U4$&'%7V2 7%B%72%"#4*(,$+*
! 7%B%72%:)(-M+7'/"?6&$,",-%"(477%*,"2,7$*."42$*."26&$,IS"SK>"
,-%*"7%B%72%"%)(-"$*'$B$'4)&";+7'"42$*."7%B%72%A%5,
(# (#
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
($ ($
LECTURE 8 – CLASSES PART 3
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
OVERLOADING
DEFAULT CONSTRUCTION
GOALS FIELD INITIALIZATION
!
OVERLOADING
!!"#$%&&"#%'"(%)*"+,-*".(%'",'*"#,'&.-/#.,-0
! !"#$%&'($)*+# ,+--.&+-/0/%+1/!"#$%&'($)*+#234
!"#$%&'($)*+# "5*56$-" 0/%+1/!"#$%&'($)*+#2785/*59:%;34
!1(*"#,'&.-/#.,-"'%+*"2&"!"#$%!&'#'3
!4%+*"5"6%-%+*.*-".76*&"8"9*.(,:"()*+&,-$#3
!;)*-$,%:2'<"-*&,$/.2,'0"1(*"#,+62$*-"62#=&".(*"%66-,6-2%.*")*-&2,'">-,+"
.(*"%-</+*'.".76*&3
!?,/"#%'",)*-$,%:"%'7"+*.(,:0
! !"#$%&'$%()*+,-$%".
!"#$%&'$%()*+,-$%"/0$%".
!"#$%&'$%()*+,-!"#$%&.
!"#$%&'$%()*+,-!"#$%&/0$%".
!1(*"-*./-'".76*"2&"',."%"6%-.",>".(*"+*.(,:"&2<'%./-*3
!@%'",)*-$,%:"%"+*.(,:"A7"/&2'<":2>>*-*'."'/+A*-",>"6%-%+*.*-&B",-:*-"
,>"6%-%+*.*-&B",-":%.%".76*&",>"6%-%+*.*-&3
" "
OVERLOADING
!!"#$%&'(
!"#$%&'&$())'*"+',
--'./01$2(303')"+456'78%)')"+'9(:0)'9;2'%<9 !(1(+0901)'
!"#$%&'%<9 )"+4%<9 =>'%<9 ?5'
,'
109"1<'4='@'?5A'
B'
--'./01$2(303')"+456'78%)')"+'9(:0)'98100'%<9 !(1(+0901)'
!"#$%&'%<9 )"+4%<9 =>'%<9 ?>'%<9 C5'
,'
109"1<'4='@'?'@'C5A'
B'
--'./01$2(303')"+456'78%)')"+'9(:0)'9;2'32"#$0'!(1(+0901)'
!"#$%&'32"#$0')"+432"#$0'=>'32"#$0'?5'
,'
109"1<'4='@'?5A'
B
--'D1%/01'&230'
!"#$%&')9(9%&'/2%3'+(%<4*91%<E'(1E)FG5'
,'
*"+')'H'<0;'*"+45A'
*?)90+62"96!1%<9$<4)6)"+4IJ>'KJ55A'
*?)90+62"96!1%<9$<4)6)"+4IJ>'KJ>'LJ55A'
*?)90+62"96!1%<9$<4)6)"+4IJ6M>'KJ6M55A'
B'
B
# #
OVERLOADING
!!"#$%&'(
!"#$%&'&$())'*"+',
!"#$%&'%<9 )"+4%<9 =>'%<9 ?5'
,'
109"1<'4='@'?5A'
B'
!"#$%&'%<9 )"+4%<9 =>'%<9 ?>'%<9 C5'
,'
109"1<'4='@'?'@'C5A'
B'
!"#$%&'32"#$0')"+432"#$0'=>'32"#$0'?5'
,'
109"1<'4='@'?5A'
B
--'N2+!%$(9%2<'O1121
!"#$%&'32"#$0')"+4%<9 =>'%<9 ?5'
,'
109"1<'4='@'?5A'
B'
!"#$%&')9(9%&'/2%3'+(%<4*91%<E'(1E)FG5'
,' &'('%>'1?,%@1"A%A-0>-%
*"+')'H'<0;'*"+45A' 8B9%9$,-"/%,"%>'CC%
*?)90+62"96!1%<9$<4)6)"+4IJ>'KJ55A'
*?)90+62"96!1%<9$<4)6)"+4IJ>'KJ>'LJ55A' D'8$/%"1%#$,B#1%,4E$%
*?)90+62"96!1%<9$<4)6)"+4IJ6M>'KJ6M55A' 'C"1$6
B'
B
$ $
DEFAULT CONSTRUCTION
!!">2*$:".(%."2&'C."*D6$2#2.$7"&*."2'"%"#,'&.-/#.,-"2&"EB",123)B",-"%4223
!!"#$%&'()!##2:*'.%$$7"/'2'2.2%$2F*:")%-2%A$*&"#%'"$*%:".,"'/$$"6,2'.*-"
*--,-&3
! 5462$708952:;))-.0<0%19)0=0>?@0A
'0'0'
B:712C1") D0=0D1##;'&)"E$#)C1;-.@
$%" ;)1#0=0D'&)"F)1#-.@
!G>"%"#$%&&"(%&"+!./!+(,$-/,!$B"%"',H%-</+*'."#,'&.-/#.,-"2&"6-,)2:*:3
!G>"%"#$%&&"(%&"%."$*%&.",'*"#,'&.-/#.,-B".(*"',H%-</+*'."#,'&.-/#.,-"2&"',."
6-,)2:*:3
!I/."7,/"#%'"6-,)2:*"2.0
! 5462$708952:;))-.0<A
% %
FIELD INITIALIZATION
!!"#$%&'$"()**+,)$-.)$!"#$%&'"()%% ,)/�-$/"*$/+)0,12
! *%$&&+,-.%/0''
1
.234$5'+6523(7+($-'+8+9:;
<+<+<
=
!3.)$+'+-+&0+4&-+"'$(&0#)$%&'$5)$%"67#-),2
! *%$&&+,-.%/0''
1
.234$5'+&5$53*+3(5 ('>5?@;
.234$5'+3(5 3@+8+$&&37(?@AB;
<+<+<
.234$5'+&5$53*+3(5 $&&37(?@AB
1
3(5 2+8+('>5?@;
('>5?@CC;
2'5)2(+2;
=
<+<+<
=
& &
CONSTRUCTION PARAMETER NAMES
!!"#$%&'"(')##$'*%+,-$%*,.(+$/+$00$'%&)')#$0$'%.)#$*1
! !"#$%&'()!$*+,,-./0%12'13'4*"#$,'56
7
18),'9'1:
58$80+'9'5:
;
!2"'%3$00$'%4"56#$.0)0,".7%5).%6*$%)%&'$8,91
! !"#$%&'()!$*+,,-./0%12'8<8),3'4*"#$,'8.8$80+6
7
18),'9'8<8),:
58$80+'9'8.8$80+:
;
!:).%6*$%/=%5 0"%4,*0,.(6,*;%3$0<$$.%&)')#$0$'*%).4%8,$+4*1
! !"#$%&'()!$*+,,-./0%12'18),3'4*"#$,'58$80+6
7
/=%5>18), 9'18),:
/=%5>58$80+ 9'58$80+:
;
' '
LAB 2
*+"$),&#-..)'//0)$&)0&(
! J':*-&.%':".(*"*D2&.2'<"&.%-.*-"#,:*"K(%-:LM
! G+6$*+*'."%"&*-2*&",>"N.-2'<">/'#.2,'&"K%$&,"(%-:LM"
( (
LAB 2
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! 9%2'">/'#.2,'
!"#$%&'()*)%&'+,%-'.*%/01)2%/3'*23(456
7
1)2%/3')891)2%/3 :'1;<=;>1;=?@AB
:10,0'C0F$/%,"%G'D> /$HI
1&*//92'(':'/9C'1&*//9201D()9.E%/6B
#,,$9*/ 2"/':')2"9B J8$#%01EB,%C""E
-,
7
1D()9.E,")E!2%/)0FG/)92'H,..*/-I'F6B
K$'/%B8$#%01EB,
1)2%/3'$%/9':'(E/9J)K%/906B
1)2%/345'&,..*/-L,2-( :'$%/9E(!$%)0F'F6B !"1($#,%B8$#%01EB,%,"%'##'4%D'8$/%"1%8E'>$8
MM'N*/-$9'FO"%)F'(!9&%*$$DE
%P'0FO"%)FE9O"*$(0&,..*/-L,2-(4Q566
7 L'88%D",-%,-$%8,#01M%)G,-$5,#01MI2%'1/%,-$%B8$#%
R
2"/':'P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B#1%,-$%B8$#%
01EB,P%>"1>',$1',01M%'CC%$C$9$1,8% G$1,$#5,#01MI%>"99'1/%>"##$>,C46%N$%E#01,%'1%
"H%,-$%B8$#%01EB,%'##'4%TU;.K%,-$% $##"#%9$88'M$%B801M%E#01,7$CEP%,-$1%#$,B#1%1BCC%
8"%,-',%,-$%8,#01M%08%1",%>-'1M$/6
*!" $C$9$1,6%;-08%A0CC%"($#A#0,$%
,-$%>B##$1,%8,#01M%A0,-%A-',$($#%
,-$%B8$#%$1,$#$/%'H,$#%
)!G$1,$#5,#01MI%01%>"18"C$6 )!
LAB 2
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! #,+A2'*P,-:&Q-,+ /.2$2.7">/'#.2,'
!,%L*)/'()*)%&'+),%-.'&38#%-/93,4(J,382+),%-.67'13,4(5'%-) %-4/M:
;
+),%-.'-/1+),%-. N'FF@
?3,2%-) % N'%-4/M@'% C'13,4(B$/-.)>@'%ONK:
; T%8,#01M%'##'4%)GA"#/8I2%'1/%'1%01,$M$#%01/$V%
%?2% P'%-4/M:
;
)G01/$VI2%'#$%E'88$/%01,"%,-$%HB1>,0"16
-/1+),%-. ON'F'F@
I
-/1+),%-. ON'13,4(6%7@
I
,/)",-'-/1+),%-.@ ;-08%HB1>,0"1%809EC4%>"1>',$1',$8%'CC%"H%,-$%
I 8,#01M8%0180/$%"H%,-$%'##'4%GA"#/8I%8,'#,01M%H#"9%
,-$%01/$V%G01/$VI%,"%,-$%$1/%"H%,-$%'##'46%;-$1%0,%
#$,B#18%,-',%'8%'%8,#01M6
.V'9EC$W%A"#/8%08%'1%'##'4%>"1,'0101M%,-#$$%
$C$9$1,8P%GTEEC$8I%)01/$V%+2P%G'#$I%)01/$V%*2P%
GM""/6I%)01/$V%<26%:H%G01/$VI%08%*P%,-$1%,-$%8,#01M%
G'#$%M""/6I%A0CC%D$%#$,B#1$/6
)" )"
LAB 2
789./8/'$)")3/2%/3)&:);$2%'5):#'6$%&'3
! Q2$$"2'".(*":2>>*-*'.">/'#.2,'"&./A&
! N,+*"(2'.&"%-*"6-,)2:*:"2'".(*"#,:*"#,++*'.&
! R*%:".(*"S%)%"N.-2'<"!TGB"+%'7"/&*>/$">/'#.2,'&"O2$$"(*$6"7,/"
KU,,<$*"VW%)%"&.-2'<"%62XM
! Y2'.&
! G+6$*+*'."&*%-#(1*D. /&2'<"2':*D;>
! G+6$*+*'."-*+,)*1*D. /&2'<"-*6$%#*!$$K.*D.B"ZZM
! G+6$*+*'."%::1*D. /&2'<"&/AN.-2'< 5".*D."5"&/AN.-2'<
! G'.*<*-36%-&*G'. O2$$"A*"/&*>/$
! -*)*-&*1*D.0"J&*"N.-2'<I/2$:*-[& -*)*-&*">/'#.2,'
! -*)*-&*\%#(P,-:0"N6$2.".(*"#/--*'."&.-2'<"/&2'<"&6$2.KZ"ZMB"
.(*'"-*)*-&*"*%#("2':2)2:/%$"O,-:"/&2'<"-*)*-&*1*D.
)# )#
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
)$ )$
LECTURE 9 – MULTI-CLASS SYSTEMS
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
PACKAGES
CLASS DESIGN
GOALS PERSON CLASS EXAMPLE
!
PACKAGES
!!"#$%"&'(#$))")'$*"'+*,$-./"&'.-%+'0$(1$,")2
! !"#"$%"&'
!"#"$()*%
!"#"$)*+,
$-$-$
!34+.&)'-$5"'(+-6#.(%2'!"#"$%&'($)"&* +,!"#"$-.($)"&*
!7$(1$,")'&+'-+%'-")%2'8+'*"#$%.+-)9.0':"%;""-'!"#"$%&'( $-&'
!"#"$%&'($!"/
" "
PACKAGES
!<$-'$(("))'(#$))")'6*+5'$-='0$(1$,"';.%9'6>##='?>$#.6."&'-$5"2
! !"#"$&'0*$123"()"&* &24"5,6,!"#"$&'0*$123"()"&*$7289:
!@50+*%')%$%"5"-%)'*"5+4"'%9"'%"&.+>)'*"0"%.%.+-2
! '0;2/&,!"#"$&'0*$<=
$,$,$
123"()"&* &24"5,6,123"()"&*$7289:=
!<$-'.50+*%').-,#"'(#$))2
! '0;2/&,!"#"$&'0*$123"()"&*=
# #
PACKAGES
!7>%'$'0$(1$,"'&"(#$*$%.+-'$%'%9"'%+0'+6'%9"'6.#"2
! ;"3>"?*,320$@2/-&0"77$32/*!"#"=
;%A('3,3("--,B0;(25**
C
$,$,$
D
!3'(#$))';.%9+>%'$'0$(1$,"'&"(#$*$%.+-'.)'.-'%9"'!"#$%&'()$*+$,"A
!7#$("'%9"')+>*("'6.#"'.-%+'$')>:&.*"(%+*='%9$%'5$%(9")'%9"'0$(1$,"'-$5"A
!<+50.#"'6*+5'%9"':$)"'&.*"(%+*=2
! !"#"3 320E@2/-&0"77E32/*!"#"EB0;(25**$!"#"
$ $
CLASS DESIGN
!3#;$=)'1""0'&$%$'0*.4$%"A
!3#;$=)'.-.%.$#./"'&$%$A
!B+-C%'>)"'%++'5$-=':$).('%=0")'.-'$'(#$))2
% %
PERSON CLASS EXAMPLE
!"#$%&'&$())'*+,)-.
/
!"#$%&'01,%.2'*3456
!"#$%&'01,%.2'0076
>8$%?#0(',$%@"#%018,'1A$%('#0'BC$8D
!"#$%&'01,%.2'8%,)17(9+6
!"#$%&'01,%.2'9%::$+4.%1%($6
!"#$%&'01,%.2'$()17(9+6
!"#$%&'01,%.2')1,++1;::,+))<6
!"#$%&'01,%.2')1,++1;::,+))=6
!"#$%&'01,%.2'&%1>6
!"#$%&'01,%.2')1(1+6
!"#$%&'01,%.2'?4*6
!"#$%&'01,%.2'&-".1,>6
!"#$%&'01,%.2'+9(%$6
!"#$%&'01,%.2'&+$$*@-.+6
!"#$%&'01,%.2'-88%&+*@-.+6
!"#$%&'01,%.2'8(A7"9#+,6
B
& &
PERSON CLASS EXAMPLE
!"#$%&'&$())'*+,)-.
/
!,%C(1+'01,%.2'*3456
!,%C(1+'01,%.2'0076
!,%C(1+'01,%.2'8%,)17(9+6
!,%C(1+'01,%.2'9%::$+4.%1%($6
!,%C(1+'01,%.2'$()17(9+6
!,%C(1+'01,%.2')1,++1;::,+))<6
!,%C(1+'01,%.2')1,++1;::,+))=6
!,%C(1+'01,%.2'&%1>6
!,%C(1+'01,%.2')1(1+6
!,%C(1+'01,%.2'?4*6
!,%C(1+'01,%.2'&-".1,>6
!,%C(1+'01,%.2'+9(%$6
!,%C(1+'01,%.2'&+$$*@-.+6
!,%C(1+'01,%.2'-88%&+*@-.+6
!,%C(1+'01,%.2'8(A7"9#+,6
B
' '
PERSON CLASS EXAMPLE
!"#$%&'&$())'*+,)-. !@)'%9.)'$',++&'+*':$&'&").,-D
/
!,%C(1+'01,%.2'*3456 !<$-'.%':"'5$&"':"%%"*D
!,%C(1+'01,%.2'0076 ! 7+).%.4")D
!,%C(1+'01,%.2'8%,)17(9+6
!,%C(1+'01,%.2'9%::$+4.%1%($6 ! 8",$%.4")D
!,%C(1+'01,%.2'$()17(9+6 ! B").,-'#.5.%$%.+-)D
!,%C(1+'01,%.2')1,++1;::,+))<6
!,%C(1+'01,%.2')1,++1;::,+))=6
!,%C(1+'01,%.2'&%1>6
!,%C(1+'01,%.2')1(1+6
!,%C(1+'01,%.2'?4*6
!,%C(1+'01,%.2'&-".1,>6
!,%C(1+'01,%.2'+9(%$6
!,%C(1+'01,%.2'&+$$*@-.+6
!,%C(1+'01,%.2'-88%&+*@-.+6
!,%C(1+'01,%.2'8(A7"9#+,6
B
() ()
DESIGN
!"#$%&'&$())'*+,)-.
/
!,%C(1+'01,%.2'*3456
!,%C(1+'01,%.2'0076
E$#8"1
!,%C(1+'01,%.2'8%,)17(9+6
!,%C(1+'01,%.2'9%::$+4.%1%($6
!,%C(1+'01,%.2'$()17(9+6
!,%C(1+'01,%.2')1,++1;::,+))<6
!,%C(1+'01,%.2')1,++1;::,+))=6
!,%C(1+'01,%.2'&%1>6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.3'9%,)18(:+7
!,%0(1+'21,%.3':%;;$+5.%1%($7
!,%0(1+'21,%.3'$()18(:+7
!,%0(1+'21,%.3')1,++1<;;,+))=7
!,%0(1+'21,%.3')1,++1<;;,+))>7
!,%0(1+'21,%.3'&%1?7
!,%0(1+'21,%.3')1(1+7
G//#$88 !"1,'A, !,%0(1+'21,%.3'@5*7
!,%0(1+'21,%.3'&-".1,?7
!,%0(1+'21,%.3'+:(%$7
!,%0(1+'21,%.3'&+$$*A-.+7
!,%0(1+'21,%.3'-99%&+*A-.+7
!,%0(1+'21,%.3'9(B8":#+,7
C
(# (#
DESIGN - OBJECTS
!"#$%&'&$())'*+,)-.
!"#$%&'&$())'8(:+
/
/
!,%0(1+'21,%.3'*4567
!,%0(1+'21,%.3'9%,)18(:+7
!,%0(1+'21,%.3'2287
!,%0(1+'21,%.3':%;;$+5.%1%($7
!,%0(1+'8(:+':?8(:+7
!,%0(1+'21,%.3'$()18(:+7
!,%0(1+'<;;,+))')&A--$<;;,+))7
C
!,%0(1+'<;;,+))'A-:+<;;,+))7
!,%0(1+'D-.1(&1'E-,FD-.1(&17
!,%0(1+'D-.1(&1'!+,)-.($D-.1(&17
!"#$%&'&$())'<;;,+))
C /
!,%0(1+'21,%.3')1,++1<;;,+))=7
!"#$%&'&$())'D-.1(&1 !,%0(1+'21,%.3')1,++1<;;,+))>7
/
!,%0(1+'21,%.3'&%1?7
!,%0(1+'21,%.3'+:(%$7
!,%0(1+'21,%.3')1(1+7
!,%0(1+'21,%.3'&+$$*A-.+7
!,%0(1+'21,%.3'@5*7
!,%0(1+'21,%.3'-99%&+*A-.+7
!,%0(1+'21,%.3'&-".1,?7
!,%0(1+'21,%.3'9(B8":#+,7
C
C
($ ($
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&1&23#0.4%#5
(% (%
LECTURE 10 – INHERITANCE
E. Cho Smith
CNIT 255
[email protected]
2
CLASSES, SUPERCLASSES, SUBCLASSES
➢Can build classes from existing classes.
➢New class inherits features from existing class.
➢Example: Managers are in many aspects like employees.
➢But in other aspects they are different.
➢ Managers get a bonus if they actually achieve what they are supposed to do
➢Every manager is an employee, but not every employee is a manager.
➢The class of managers is a subclass of the class of employees.
➢The Employee class is a superclass.
3 3
DEFINING SUBCLASSES
➢Use the extends keyword:
➢ public class Manager extends Employee
{
added methods and fields
}
➢Add fields and methods:
➢ public class Manager extends Employee
{
private double bonus;
. . .
public void setBonus(double bonus)
{
this.bonus = bonus;
}
}
➢Manager inherits methods from superclass: getName, getHireday,
getSalary, raiseSalary.
➢Superclass fields name, salary, hireDay, are present in all Manager
objects.
4 4
OVERRIDING METHODS
➢When an inherited method is not appropriate, need to override it in the subclass.
➢First attempt:
➢ public class Manager extends Employee
{
. . .
public double getSalary()
{
return salary + bonus; // won’t work
}
}
➢Subclass methods cannot access private superclass fields.
➢Second attempt:
➢ public double getSalary()
{
return getSalary() + bonus; // still won’t work
}
➢Use super to avoid recursive call:
➢ public double getSalary()
{
return super.getSalary() + bonus;
}
5 5
SUBCLASS CONSTRUCTION
➢Subclass constructor can invoke superclass constructor:
➢ public Manager(String name, double salary, int year,
int month, int day)
{
super(name, salary, year, month, day);
bonus = 0;
}
➢Call using super must be the first statement.
➢If not explicit call to superclass constructor, no-arg constructor of
superclass is invoked.
➢If the superclass does not have a no-arg constructor, the compiler
reports an error.
6 6
POLYMORPHISM
➢Consider a mix of employees and managers:
➢ staff[0] = boss;
staff[1] = new Employee(“Harry Hacker, 50000, 1989, 10, 1);
staff[2] = new Employee(“Tony Tester”, 40000, 1990, 3, 15);
➢Print out everyone’s salaries:
➢ for (Employee e : staff)
System.out.println(e.getName() + “ ” + e.getSalary());
➢Which getName method gets called?
➢ There is only one: Employee.getName
➢Which getSalary method gets called?
➢ Employee.getSalary or Manager.getSalary?
➢ It depends on the actual type of e!
➢Polymorphism: A variable can refer to multiple types.
➢Dynamic binding: The appropriate method is selected.
➢Makes programs extensible: Other types can be added later.
7 7
MORE ABOUT OVERRIDING
➢Caution: Argument types of overriding method must match exactly:
➢ class Employee
{
public void setBoss(Employee boss) { . . . }
. . .
}
class Manager
{
public void setBoss(Manager boss) { . . . } // Does not override; this
// is an entirely new
// method.
. . .
}
➢Use @Override annotation to make the compiler check:
➢ @Override public void setBoss(Employee boss)
8 8
MIDTERM EXAM 1
➢October 21 from 1:30 to 2:20 pm at MATH 175
➢ Slides [1] to [12]
➢ All in-class activities and my Feedback on Brightspace
➢ 20 True/False Questions
➢ 30 Multiple choice questions (3, 4, 5 choices)
➢ Understand concepts and problems we went over instead of
memorizing them.
➢ All DRC accommodations will be managed through the DRC.
I will soon post the details of the procedure, so please
keep an eye on the Announcements section on Brightspace.
➢ There will be no review on October 16th (I have already
covered the important concepts extensively in my
feedback posted on Brightspace).
➢ You can start preparing for the midterm exam as early as
October 2, since slide 12 will be covered that day.
9 9
LECTURE 11 – INHERITANCE PART 2
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
FINAL CLASSES AND METHODS
CASTING
GOALS ABSTRACT METHODS
ABSTRACT CLASSES
PROTECTED ACCESS
!
FINAL CLASSES AND METHODS
!!"!"#$% #$%&&"#%''()"*+"+,)+'-+-.
! &'(%")*!"#$%*)%$++*,-.)'/"0.*.-/.#1+*2$#$3.4
5
6*6*6
7
!! !"#$%*/+)0(-"#%''()"*+"(1+223--+'.
! &'(%")*)%$++*,8&%9:..
5
6*6*6
&'(%")*!"#$%*;/4"#3*3./<$8.=>*5*4./'4#*#$8.?*7
7
" "
CASTING
!4(/+)3/+&5"6(7"8'(9"/(2+")0%'")0+"#(/:3$+2"%*(7)")0+"%#)7%$")6:+"(;"
%"1%$7+<
!47::(&+"6(7"8'(9")0%)"+/$!!@AB 3&"$*2$#$3.4<
!=("#%$$"2$#$3.4 /+)0(-&5"6(7"'++-")("!"#$.
! 2$#$3.4*(9++*C*=2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*/;)A%/3'8$(8'),'K88!'3,%/3D'G6=
%E'0GI"%)G<8I"*$(0(</8J)L%/80666
7
#28*K=
;-08%?'#,%"B%,-$%J"/$%08%
M J"9?@$,$@4%/"1$%'@#$'/4N%0,%
BB'N*%/'?2,.!)'*/-'%/!")'A*/-$%/3< 809?@4%-'1/@$8%A8$#%01?A,%'1/%
1;()8.<,")<!2%/)0GO/)82')A8'(8/-82H('PQRF',2'ST'),'+%8:'&A*)'A%(),2;D'G6=
%/) "%- 9'(</8J)Q/)06= J'@@8%,-$%'??#"?#0',$%
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
%E'0"%- 99'ST6 BA1J,0"18N%8AJ-%'8%
7
!2%/)UA*)V%(),2;0(F':6=
FL$,K$#8"1O4M:PH%'1/%
M
&,/)%/"8= F8$1/Q$88'L$;"H
?82(,/'(8/-82'9':<38)?82(,/W;PQR0"%-6=
%E'0(8/-82'99'/"$$6
7
1;()8.<,")<!2%/)$/0G?82(,/':%)A'PQR'99'G'X'"%- X'G'/,)'E,"/-<G6=
'' &,/)%/"8= ''
M
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-,
! E231+2<M%1% ! K%3'";7'#)3('
!"#$%&'()*)%&'+,%-'.*%/01)2%/3'*23(456
7
1&*//82'('9'/8:'1&*//8201;()8.<%/6=
>8#(%)8':'9'/8:'>8#(%)806=
*--?8,!$8@,0:6=
:A%$80)2"86
7 !'@@%F?#01,!-',708,"#4H
BB'C%2()D'("!!,2)'E,2');!%/3'(,.8)A%/3'),'8/-')A8'!2,32*.'/*)"2*$$;F
BB'%/()8*-',E'$,,!%/3'E,28+82< 0B%A8$#%01?A,%E'8%D*
1;()8.<,")<!2%/)0G@;!8'HI"%)H'),'8J%)F'*/;)A%/3'8$(8'),'K88!'3,%/3D'G6=
%E'0GI"%)G<8I"*$(0(</8J)L%/80666
7
#28*K=
M
R$,%,-$%?$#8"1%"CI$J,%
BB'N*%/'?2,.!)'*/-'%/!")'A*/-$%/3<
1;()8.<,")<!2%/)0GO/)82')A8'(8/-82H('PQRF',2'ST'),'+%8:'&A*)'A%(),2;D'G6= C'8$/%"1%,-$%:P%
%/) "%- 9'(</8J)Q/)06=
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
8?$J0B0$/%C4%,-$%A8$#
%E'0"%- 99'ST6
7
!2%/)UA*)V%(),2;0(F':6=
&,/)%/"8=
:B%E$%/0/1S,%B01/%,-$%
M ?$#8"1%"CI$J,N%?#01,%'%
?82(,/'(8/-82'9':<38)?82(,/W;PQR0"%-6= 9$88'L$%'1/%#$8,'#,%,"%
%E'0(8/-82'99'/"$$6
7 ,-$%C$L01101L%"B%,-$%
'!
1;()8.<,")<!2%/)$/0G?82(,/':%)A'PQR'99'G'X'"%- X'G'/,)'E,"/-<G6=
&,/)%/"8= @""? '!
M
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-,
! E231+2<M%1% ! K%3'";7'#)3('
BB'Y(K'E,2')A8'28&8%+82H('"%-F'$,,K')A8.'"!F'*/-'A*/-$8')A8
BB'&*(8':A828')A8;'*28'/,)'E,"/-<
1;()8.<,")<!2%/)0GO/)82')A8'28&8%+82H('PQRD'G6=
"%- 9'(</8J)Q/)06=
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
?82(,/'28&8%+82'9':<38)?82(,/W;PQR0"%-6=
%E'028&8%+82'99'/"$$6
7 R$,%,-$%?$#8"1%
1;()8.<,")<!2%/)$/0G?82(,/':%)A'PQR'99'G'X'"%- X'G'/,)'E,"/-<G6=
&,/)%/"8= "CI$J,%C'8$/%"1%,-$%
M
:P%8?$J0B0$/%C4%,-$%
BB'Z8)')A8'.8((*38'*/-')A8')%.8()*.!
1;()8.<,")<!2%/)0GO/)82')A8'.8((*38')8J)'#8%/3'(8/)D'G6=
A8$#%01%,-$%8'9$%E'4%
1)2%/3'.8((*38'9'(</8J)L%/806= '8%C$B"#$
$,/3':A8/18/) 9'1;()8.<&"228/)@%.8N%$$%(06=
(8/-82<(8/-N8((*38@,028&8%+82F'.8((*38F':A8/18/)F':6=
R$,%,-$%'J,A'@%
M
M 9$88'L$%8?$J0B0$/%C4%
,-$%A8$#
T01'@@4N%8$1/%,-$%
9$88'L$%B#"9%,-$%
8$1/$#%,"%,-$%#$J$0($#
'" '"
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-,
! E231+2<M%1% ! :23')@0%)N3&)(26 ;7'#)3('
!"#$%&'()*)%&'+,%-'!2%/)UA*)V%(),2;01&*//82'(F'>8#(%)8':6
7 U$'/8%,E"%:P8%B#"9%
1;()8.<,")<!2%/)0GO/)82')A8'E%2()'!82(,/H('PQRD'G6=
%/) E%2()PQR 9'(</8J)Q/)06= 01?A,N%,-$1%J'@@8%
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
F-'1/@$K#01,Q$88'L$8H
1;()8.<,")<!2%/)0GO/)82')A8'(8&,/-'!82(,/H('PQRD'G6=
%/) (8&,/-PQR 9'(</8J)Q/)06=
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
M
A*/-$8?2%/)N8((*38(0:F'E%2()PQRF'(8&,/-PQR6=
V",$%,-',%,-$%G$C80,$%
"CI$J,%FEH%08%C$01L%
?'88$/%'#"A1/6%G-4W
O$J'A8$%9"8,%"B%,-$%
#$XA0#$/%BA1J,0"1'@0,4%
E0@@%C$%J"1,'01$/%01%,-$%
G$C80,$%J@'886
'# '#
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-, R"'@%"B%,-08%BA1J,0"1%08%,"%
! E231+2<M%1% ! 0%'-$+O23')K+&&%B+& ;7'#)3(' ?#01,%,-$%9$88'L$%-08,"#4%
!"#$%&'()*)%&'+,%-'A*/-$8?2%/)N8((*38(0>8#(%)8':F'%/) E%2()PQRF'%/) (8&,/-PQR6 C$,E$$1%,E"%?$"?@$
7
BB'P(%/3':<38)N8((*38(C,206F'!2%/)(')A8'.8((*3%/3'A%(),2;'#8):88/
BB')A8'?82(,/':%)A'E%2()PQR */-')A8'?82(,/':%)A'(8&,/-PQRF'%/')A8',2-82
BB')A,(8'.8((*38(':828'(8/)<
R$,%B0#8,%?$#8"1
?82(,/'*'9':<38)?82(,/W;PQR0E%2()PQR6=
%E'0*'99'/"$$6
7
1;()8.<,")<!2%/)$/0G?82(,/':%)A'"%- GXE%2()PQRXG'/,)'E,"/-F'&*/H)'!2%/)'.8((*38'A%(),2;G6=
M
?82(,/'#'9':<38)?82(,/W;PQR0(8&,/-PQR6=
%E'0#'99'/"$$6
R$,%8$J"1/%?$#8"1
7
1;()8.<,")<!2%/)$/0G?82(,/':%)A'"%- GX(8&,/-PQRXG'/,)'E,"/-F'&*/H)'!2%/)'.8((*38'A%(),2;G6=
M
1;()8.<,")<!2%/)$/0G1A,:%/3'&A*)'A%(),2;'#8):88/'4GX*<38)C%2()[*.806XG5'*/-'4GX#<38)C%2()[*.806XG5G6=
#,,$8*/ */;'9'E*$(8=
N8((*3845'.8((*38('9':<38)N8((*38(C,20E%2()PQR6=
E,20%/) % 9'\='% ]'.8((*38(<$8/3)A='%X9T6
R$,%YZZ%"B%,-$%9$88'L$8%
7
BB'@^R^'S ,/&8';,"'A*+8'%.!$8.8/)8-')A8'&,-8'%/'N8((*38<_*+*F'"/&,..8/)
B"#%B0#8,%?$#8"1%)01J@A/$8%
BB')A%('S %)':%$$'/,)'&,.!%$8'"/)%$')A8/<''`,"'.*;'/88-'),'&A*/38 9$88'L$8%E0,-%YV[\V.%
BB'(,.8',E')A8'.8)A,-'/*.8('"(8-'A828<
01%,-$%848,$92
BB'%E'0.8((*38(4%5<38)18/-8206<38)PQR06'a9'(8&,/-PQR bb
BB'''''.8((*38(4%5<38)c8&8%+8206<38)PQR06'a9'(8&,/-PQR6
BB'7
BB'''''&,/)%/"8=
'$ BB'M '$
BB
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-,
! E231+2<M%1% ! 0%'-$+O23')K+&&%B+& ;7'#)3('
E,20%/) % 9'\='% ]'.8((*38(<$8/3)A='%X9T6
7 ;-08%@""?%E0@@%$>'901$%
BB'@^R^'S ,/&8';,"'A*+8'%.!$8.8/)8-')A8'&,-8'%/'N8((*38<_*+*F'"/&,..8/)
BB')A%('S %)':%$$'/,)'&,.!%$8'"/)%$')A8/<''`,"'.*;'/88-'),'&A*/38
$'J-%9$88'L$%,"%8$$%0B%
BB'(,.8',E')A8'.8)A,-'/*.8('"(8-'A828< $0,-$#%,-$%8$1/$#%"#%,-$%
BB'%E'0.8((*38(4%5<38)18/-8206<38)PQR06'a9'(8&,/-PQR bb V",%'%9',J-N%8"% #$J$0($#%"B%,-$%9$88'L$%
BB'''''.8((*38(4%5<38)c8&8%+8206<38)PQR06'a9'(8&,/-PQR6
BB'7 8]0?%,"%,-$%1$>,% 08%,-$%8$J"1/%?$#8"16
BB'''''&,/)%/"8=
BB'M
0,$#',0"1%"B%,-$%
BB
BB'*/;'9')2"8=
B"#%@""?6 G-4%08%,-08%1$$/$/W%
BB'1;()8.<,")<!2%/)$/0GY)'0G'X'.8((*38(4%5<38)?28));>A8/18/)06XG6F'GX O$J'A8$%E$%E'1,%,"%]$$?%
BB''''''''''''''''''''.8((*38(4%5<38)18/-8206<38)C"$$[*.806XG'(*%-D'dGG'X
BB''''''''''''''''''''.8((*38(4%5<38)N8((*38@8J)06'X'GdGG6= "1@4%9$88'L$8%C$,E$$1%
M
%E'0a*/;6 B0#8,%'1/%8$J"1/%?$#8"16
7
1;()8.<,")<!2%/)$/0G[^'NO11YZO'VQ1@^c`'C^P[R'C^c'@VO1O'@>^'P1Oc1<G6=
M
M
:8%'%9',J-N%8"%
?#01,%"A,%,-$%
9$88'L$
'% '%
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-, ;-08%BA1J,0"1%'//8%
8$($#'@%-'#/J"/$/%
! E231+2<M%1% ! %--O+(:$+=( ;7'#)3('
!"#$%&'()*)%&'+,%-'*--?8,!$8@,0>8#(%)8':6
?$"?@$%,"%,-$%G$C80,$%
7 "CI$J,%,-',%08%?'88$/%01%
BB'Y--',/8'!82(,/'),')A8'>8#(%)8<''`,"':%$$'$%K8$;'A*+8'),'&A*/38')A%(
BB'%E';,"'"!-*)8')A8'?82(,/'&,/()2"&),2< '8%'1%'#LA9$1,
BB'?82(,/'@Y'9'/8:'?82(,/0T\\TF'GeffGF'G@YG6=
?82(,/'@Y'9'/8:'?82(,/0T\\T6=
:<*--?82(,/0@Y6=
BB'Y--'(8+82*$',)A82'!8,!$8'),')A8':8#(%)8<
:<*--?82(,/0/8:'?82(,/0T\\e66= !#$',$%'%K$#8"1%"CI$J,%
:<*--?82(,/0/8:'?82(,/0T\\g66=
:<*--?82(,/0/8:'?82(,/0T\\h66= E0,-%,-$%:P%F*++*H
M
Y//%,-08%?$#8"1%,"%,-$%
E$C80,$
Y//%,-#$$%",-$#%?$#8"1%
"CI$J,8%E0,-%:P8%F*++<HN%
F*++^HN%'1/%F*++_H
'& '&
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-, ;-08%08%'%Q$88'L$%J@'88%8"%
,-',%Q$88'L$%"CI$J,8%J'1%
! K+&&%B+<M%1%
!"#$%&'&$*(('N8((*38
C$%J#$',$/
7
!2%+*)8'?82(,/'(8/-82=
!2%+*)8'?82(,/'28&8%+82=
!2%+*)8'1)2%/3'.8((*38=
!2%+*)8'$,/3':A8/18/)=
!"#$%&'N8((*380?82(,/'(8/-82F'?82(,/'28&8%+82F'1)2%/3'.8((*38F'$,/3':A8/18/)6 Q$88'L$8%-"@/%,E"%
7
%E'0(8/-82'99'/"$$6 K$"?@$%"CI$J,8%)8$1/$#%
7
)A2,:'/8:'Q$$83*$Y23".8/)OJ&8!)%,/0G(8/-82'&*/'/,)'#8'/"$$'%/'N8((*38<N8((*3806G6=
'1/%#$J$0($#2N%,-$%
M
%E'028&8%+82'99'/"$$6
9$88'L$%8,#01LN%'1/%,-$%
7 ,09$%E-$1%,-$%9$88'L$%
)A2,:'/8:'Q$$83*$Y23".8/)OJ&8!)%,/0G28&8%+82'&*/'/,)'#8'/"$$'%/'N8((*38<N8((*3806G6=
M E'8%8$1,
%E'0(8/-82<38)PQR06'99'28&8%+82<38)PQR066
7
)A2,:'/8:'Q$$83*$Y23".8/)OJ&8!)%,/0G(8/-82'*/-'28&8%+82'&*/'/,)'#8')A8'(*.8'!82(,/'%/'N8((*38<N8((*3806G6=
M
)A%(<(8/-82 9'(8/-82=
)A%(<28&8%+82 9'28&8%+82=
)A%(<.8((*38 9'.8((*38=
)A%(<:A8/18/) 9':A8/18/)=
M
!"#$%&'1)2%/3'38)?28));>A8/18/)06
') 7 ')
BB'@A%('%('*'E*/&;':*;',E'!2%/)%/3')A8'-*;'*/-')%.8'"(%/3'_*+*<)%.8<i'&$*((8(=
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-, ;-08%08%'%K$#8"1%J@'88%8"%
,-',%K$#8"1%"CI$J,8%J'1%
! O+2&('<M%1%
!"#$%&'&$*(('?82(,/
C$%J#$',$/
7
BB'@^R^'S *--')A8',)A82'E%8$-('.8/)%,/8-'%/')A8'A*/-,")F'*/-'&28*)8
BB'38))82('*/-'(8))82('E,2'8*&A<
!2%+*)8'%/) "%-=
!"#$%&'?82(,/0%/) "%-6
7
(8)PQR0"%-6=
M Y//%,-$%'??#"?#0',$%
!"#$%&'%/) 38)PQR06 K$#8"1%B0$@/8%)018,'1J$%
7
28)"2/'"%-=
('#0'C@$82%-$#$
M
!"#$%&'+,%-'(8)PQR0%/) "%-6
7
)A%(<"%- 9'"%-=
M
!"#$%&'+,%-'(8/-N8((*38@,0?82(,/'28&8%+82F'1)2%/3'.8((*38F'$,/3':A8/F
>8#(%)8':8#(%)86
7
N8((*38'.'9'/8:'N8((*380)A%(F'28&8%+82F'.8((*38F':A8/6=
:8#(%)8<*--N8((*380.6=
M
!"#$%&'1)2%/3'38)C%2()[*.806
7
BB'@^R^'S )A%('%(',/8',E')A8'38))82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+*&3)+<M%1%
!"#$%&'+,%-'*--?82(,/0?82(,/'!6
5-"A@/%'//%'%K$#8"1%"CI$J,%,"%,-$%
7
BB'>8':%$$'/88-'),'&28*)8'*'/8:'?82(,/45'*22*;')A*)'%('T'.,28'%/'(%j8
FA8$#8H%018,'1J$%('#0'C@$N%E-0J-%08%'1%
BB')A*/':A*)'k"(82(k'"(8-'),'#8F'*/-'&,!;')A8'&,/)8/)(',E'k"(82(k '##'46%;"%/"%,-08N%E$%J#$',$%'%1$E%
BB'%/),'%)<
?82(,/'/8:Y22*;45'9'/8:'?82(,/4"(82(<$8/3)AXT5= '##'4%"B%0,8%JA##$1,%@$1L,-%`%*6%G$%
E,20%/) % 9'\='% ]'"(82(<$8/3)A='%X9T6
7 ,-$1%J"?4%"($#%,-$%$@$9$1,8%B#"9%
M
/8:Y22*;4%5'9'"(82(4%5=
,-$%$>08,01L%'##'4%,"%,-$%1$E%'##'46%
BB'@^R^'S *--'!'),'/8:P(82(F'*/-'"!-*)8'k"(82(k
;-$%#$8,%08%B"#%4"A%,"%B0108-a
M
5-"A@/%@""?%,-#"AL-%,-$%FA8$#8H%
!"#$%&'?82(,/'38)?82(,/W;PQR0%/) "%-6
7 '##'4N%,-$1%#$,A#1%,-$%K$#8"1%"CI$J,%
BB'@^R^'S $,,!')A2,"3A'k"(82(kF'*/-'28)"2/')A8'E%2()'!82(,/':A,(8'"%-
BB'.*)&A8(<''^)A82:%(8F'28)"2/'/"$$'*('#8$,:< ,-',%9',J-$8%FA0/H
28)"2/'/"$$=
M
Y//%'%Q$88'L$%"CI$J,%,"%'%9$88'L$8%
+,%-'*--N8((*380N8((*38'.6
7
'##'4%)E-0J-%/"$81S,%$>08,N%4"A%1$$/%
BB'@^R^'S -8&%-8'A,:'),'(),28'.F'(,')A*)';,"'&*/'$*)82'28)2%8+8')A8 ,"%J#$',$%0,26%P"%,-08%01%,-$%8'9$%E'4%
BB'2%3A)',/8('%/'38)N8((*38(C,206<
M '8%'//01L%'%K$#8"1%"CI$J,%01%
!"#$%&'N8((*3845'38)N8((*38(C,20%/) "%-6 F'//K$#8"1H
7
BB'@^R^'S 28)"2/'*$$'.8((*38('*--8-',/')A8'>8#(%)8':A828'8%)A82
!' BB')A8'(8/-82',2')A8'28&8%+82':*(')A8'!82(,/':%)A'"%- k"%-kF'%/ !'
BB')A8',2-82')A8;':828'(8/)<
LAB 3
/+-,01$#+-%$",%,231$3+4%1$#0$,0%5'-,
! A+*&3)+<M%1% Z""?%,-#"AL-%,-$%9$88'L$8%'##'46%
!"#$%&'N8((*3845'38)N8((*38(C,20%/) "%-6
!-$J]%0B%$'J-%9$88'L$%$0,-$#%-'8%'%
7 8$1/$#%\U%#$J$0($#%,-',%9',J-$8%
BB'@^R^'S 28)"2/'*$$'.8((*38('*--8-',/')A8'>8#(%)8':A828'8%)A82
BB')A8'(8/-82',2')A8'28&8%+82':*(')A8'!82(,/':%)A'"%- k"%-kF'%/ FA0/H6%:B%8"N%'//%,-',%9$88'L$%,"%'1%
BB')A8',2-82')A8;':828'(8/)<
28)"2/'/8:'N8((*384\5= Y##'4Z08,6%G-4%A8$%'1%Y##'4Z08,
M
M
018,$'/%"B%'%#$LA@'#%'##'4W%O$J'A8$%
E$%/"1S,%]1"E%-"E%9'14%9$88'L$8%
E0@@%9',J-%'-$'/%"B%,09$6%Y##'4Z08, 08%
'1%'##'4%,-',%/"$8%1",%-'($%'%B0>$/%
80b$6
!! !!
LAB 3
6'-37&%,231$3+4%5*#11,1%$'%#--%0,8(30,-%7(+5$3'+#*3$&%
! N3')&.
! K+&&%B+<M%1%
! !--"B+))+2";7'#)3('&"B+)4+'-+25"B+)P+#+31+25"
B+)K+&&%B+=+,)5"B+)A0+'4+')<
! O+2&('<M%1%
! !--";32&)Q%/+ %'-"$%&)Q%/+ )(")0+"O+2&('"#$%&&<"@2+%)+"
B+))+2&"%'-"&+))+2&";(2"+%#0"HB+)R32&)Q%/+5"&+)R32&)Q%/+5"
B+)S%&)Q%/+5"&+)S%&)Q%/+J<"@2+%)+"%"B+)R7$$Q%/+ ;7'#)3('"
)0%)"2+)72'&";32&)Q%/+ T"U"U"T"$%&)Q%/+<"K(-3;6"O+2&('?&"
#('&)27#)(2")(")%8+")9("%--3)3('%$"%2B7/+')&")("3'3)3%$3V+")0+"
;32&)Q%/+ %'-"$%&)Q%/+ ;3+$-&<
!" !"
LAB 3
6'-37&%,231$3+4%5*#11,1%$'%#--%0,8(30,-%7(+5$3'+#*3$&%
! N3')&.
! A+*&3)+<M%1%
! @2+%)+"%"K+&&%B+"%22%6"%&"%'"3'&)%'#+"1%23%*$+<
! >'3)3%$3V+")0+"K+&&%B+"%22%6"3'")0+"#('&)27#)(2<
! @(/:$+)+")0+"#(-+"3'")0+"W%--O+2&('X";7'#)3('
! @(/:$+)+")0+"WB+)O+2&('Y6G>EX";7'#)3('
! @(/:$+)+")0+"W%--K+&&%B+X";7'#)3('
! @(/:$+)+")0+"WB+)K+&&%B+&R(2X";7'#)3('
! G&+"%'"!22%6S3&)5"*7)")0+";7'#)3('"9(1$%0,$(0+%%'"%22%6<"
G&+")0+"W)(!22%6X";7'#)3('"3'"!22%6S3&)<
!# !#
LAB 3
6'-37&%,231$3+4%5*#11,1%$'%#--%0,8(30,-%7(+5$3'+#*3$&%
! N3')&.
! E231+2<M%1%
! G:-%)+"W%--O+(:$+=(X"&(")0%)"+%#0"O+2&('"(*M+#)"3&"*+3'B"
#('&)27#)+-"93)0"%";32&)"'%/+"%'-"$%&)"'%/+"3'"%--3)3('")("%'"
>E
! G'#(//+')")0+"#(-+"3'"W0%'-$+O23')K+&&%B+&X
! @0%'B+")0+"$3'+"3'"W0%'-$+O23')K+&&%B+&X")0%)":23')&"(7)"
W40(93'B"#0%)"03&)(26"*+)9++'<<<X")(":23')"(7)")0+";7$$"'%/+&
!$ !$
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&11&23#0.4%#5
!% !%
LECTURE 12 – INHERITANCE PART 3
!"#$%$&'()"
Eunsun Cho Smith
!"#$%&&
CIT 255
'()*+,-.*-/0/*-
[email protected]
!"#$%&'('%)*+,-%./0,0"12%3%!'4%56%7"#8,9'11 )!:;%<==+*2
ARRAY LISTS
OBJECT WRAPPERS / AUTOBOXING
GOALS
!
ARRAY LISTS
!!"#$%#&'("$)*$+&$+,,+-$./$*.0#12.&3)&4#&.#&($5"#&$.($./$&)($6&)5&$.&$
+14+&3#7
!!""#$%&'( 3%+//$8+&+'#/$+&$)*+,-(./0+,,+-$("+($',)5/$+&1$/",.&6/$)&$
1#8+&17
!!"#"$%&'3%+//9$:/#$+$(-;#$;+,+8#(#,$/<3"$+/$=,,+->./(?@8;%)-##A$()$
/;#3.*-$#%#8#&($(-;#7
!B+&$)8.($(-;#$;+,+8#(#,$.&$("#$3)&/(,<3(),$C1.+8)&1$/-&(+0D9
! !""#$%&'(123456$,,70'(#88090:,;0!""#$%&'(17<=>
!:/#$#?? 8#(")1$()$+11$)EF#3($()$("#$#&19
! '(#88@#??<:,;023456$,,<AB#""$0B#-C,"AD0@0@0@==>
!!"#$3+%%$'(#88@'&E,<=0-.#%1/$("#$3<,,#&($/.G#7
!=33#//$+&1$8)1.*-$#%#8#&(/$5.("$("#$F,( +&1$',( 8#(")1/9
! 23456$,,0,090'(#88@F,(<&=>
'(#88@',(<&D0(6:$=>
!B+&$</#$H*),$#+3"I$%));$()$4./.($#%#8#&(/9
! 86"0<23456$,,0,0G0'(#88=0H$'(,3@6I(@4"&:(5:<,=>
" "
EXAMPLE
!"#$%&'()*)+,&!-+./''
#,0-!1'1-)22'3)*)45)"#-67''
#,0-!1'2&)&!1'*$!8'")!9:;&%!9<')%<2=>?7''
@%%)AB!2&C;&%!9<D')-!2&E96F'@%%)AB!2&C;&%!9<D:?/''
)-!2&+)88:G;&6*6G?/
)-!2&+)88:GH!"G?/
)-!2&+)88:GB,1AG?/
)-!2&+)88:GI)&G?/
)-!2&+)88:G@9<6-)G?/
)-!2&+)88:GH$"G?/
JJ'8!2#-)A!9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,?A,%
B#"9%C",,"9
"B%@'C%-'1/D"A,
'! '!
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! I690,62+"0" " G"9#$41#!-9%#
!"#$%&'()*)%&'+,%-'.*%/01)2%/3'*23(456
7 !#$',$%1$E%FG$C80,$H%"CI$J,
1&*//82'('9'/8:'1&*//8201;()8.<%/6=
>8#(%)8':'9'/8:'>8#(%)806=
*--?8,!$8@,0:6= !'@@%F'//K$"?@$;"H%E0,-%E$C80,$%"CI$J,%'8%'#LA9$1,
:A%$80)2"86
7 M8$#%01?A,%@""?
BB'C%2()D'("!!,2)'E,2');!%/3'(,.8)A%/3'),'8/-')A8'!2,32*.'/*)"2*$$;F
BB'%/()8*-',E'$,,!%/3'E,28+82<
1;()8.<,")<!2%/)0G@;!8'HI"%)H'),'8J%)F'*/;)A%/3'8$(8'),'K88!'3,%/3D'G6=
%E'0GI"%)G<8I"*$(0(</8J)L%/80666
7
#28*K=
;-08%?'#,%"B%,-$%J"/$%08%
M J"9?@$,$@4%/"1$%'@#$'/4N%0,%
BB'N*%/'?2,.!)'*/-'%/!")'A*/-$%/3< 809?@4%-'1/@$8%A8$#%01?A,%'1/%
1;()8.<,")<!2%/)0GO/)82')A8'(8/-82H('PQRF',2'ST'),'+%8:'&A*)'A%(),2;D'G6=
%/) "%- 9'(</8J)Q/)06= J'@@8%,-$%'??#"?#0',$%
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
%E'0"%- 99'ST6 BA1J,0"18N%8AJ-%'8%
7
!2%/)UA*)V%(),2;0(F':6=
FL$,K$#8"1O4M:PH%'1/%
M
&,/)%/"8= F8$1/Q$88'L$;"H
?82(,/'(8/-82'9':<38)?82(,/W;PQR0"%-6=
%E'0(8/-82'99'/"$$6
7
1;()8.<,")<!2%/)$/0G?82(,/':%)A'PQR'99'G'X'"%- X'G'/,)'E,"/-<G6=
'" &,/)%/"8= '"
M
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! I690,62+"0" " G"9#$41#!-9%#
!"#$%&'()*)%&'+,%-'.*%/01)2%/3'*23(456
7
1&*//82'('9'/8:'1&*//8201;()8.<%/6=
>8#(%)8':'9'/8:'>8#(%)806=
*--?8,!$8@,0:6=
:A%$80)2"86
7 !'@@%F?#01,!-',708,"#4H
BB'C%2()D'("!!,2)'E,2');!%/3'(,.8)A%/3'),'8/-')A8'!2,32*.'/*)"2*$$;F
BB'%/()8*-',E'$,,!%/3'E,28+82< 0B%A8$#%01?A,%E'8%D*
1;()8.<,")<!2%/)0G@;!8'HI"%)H'),'8J%)F'*/;)A%/3'8$(8'),'K88!'3,%/3D'G6=
%E'0GI"%)G<8I"*$(0(</8J)L%/80666
7
#28*K=
M
R$,%,-$%?$#8"1%"CI$J,%
BB'N*%/'?2,.!)'*/-'%/!")'A*/-$%/3<
1;()8.<,")<!2%/)0GO/)82')A8'(8/-82H('PQRF',2'ST'),'+%8:'&A*)'A%(),2;D'G6= C'8$/%"1%,-$%:P%
%/) "%- 9'(</8J)Q/)06=
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
8?$J0B0$/%C4%,-$%A8$#
%E'0"%- 99'ST6
7
!2%/)UA*)V%(),2;0(F':6=
&,/)%/"8=
:B%E$%/0/1S,%B01/%,-$%
M ?$#8"1%"CI$J,N%?#01,%'%
?82(,/'(8/-82'9':<38)?82(,/W;PQR0"%-6= 9$88'L$%'1/%#$8,'#,%,"%
%E'0(8/-82'99'/"$$6
7 ,-$%C$L01101L%"B%,-$%
'#
1;()8.<,")<!2%/)$/0G?82(,/':%)A'PQR'99'G'X'"%- X'G'/,)'E,"/-<G6=
&,/)%/"8= @""? '#
M
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! I690,62+"0" " G"9#$41#!-9%#
BB'Y(K'E,2')A8'28&8%+82H('"%-F'$,,K')A8.'"!F'*/-'A*/-$8')A8
BB'&*(8':A828')A8;'*28'/,)'E,"/-<
1;()8.<,")<!2%/)0GO/)82')A8'28&8%+82H('PQRD'G6=
"%- 9'(</8J)Q/)06=
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
?82(,/'28&8%+82'9':<38)?82(,/W;PQR0"%-6=
%E'028&8%+82'99'/"$$6
7 R$,%,-$%?$#8"1%
1;()8.<,")<!2%/)$/0G?82(,/':%)A'PQR'99'G'X'"%- X'G'/,)'E,"/-<G6=
&,/)%/"8= "CI$J,%C'8$/%"1%,-$%
M
:P%8?$J0B0$/%C4%,-$%
BB'Z8)')A8'.8((*38'*/-')A8')%.8()*.!
1;()8.<,")<!2%/)0GO/)82')A8'.8((*38')8J)'#8%/3'(8/)D'G6=
A8$#%01%,-$%8'9$%E'4%
1)2%/3'.8((*38'9'(</8J)L%/806= '8%C$B"#$
$,/3':A8/18/) 9'1;()8.<&"228/)@%.8N%$$%(06=
(8/-82<(8/-N8((*38@,028&8%+82F'.8((*38F':A8/18/)F':6=
R$,%,-$%'J,A'@%
M
M 9$88'L$%8?$J0B0$/%C4%
,-$%A8$#
T01'@@4N%8$1/%,-$%
9$88'L$%B#"9%,-$%
8$1/$#%,"%,-$%#$J$0($#
'$ '$
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! I690,62+"0" " 769#-8("-J9.-%6' 41#!-9%#
!"#$%&'()*)%&'+,%-'!2%/)UA*)V%(),2;01&*//82'(F'>8#(%)8':6
7 U$'/8%,E"%:P8%B#"9%
1;()8.<,")<!2%/)0GO/)82')A8'E%2()'!82(,/H('PQRD'G6=
%/) E%2()PQR 9'(</8J)Q/)06= 01?A,N%,-$1%J'@@8%
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
F-'1/@$K#01,Q$88'L$8H
1;()8.<,")<!2%/)0GO/)82')A8'(8&,/-'!82(,/H('PQRD'G6=
%/) (8&,/-PQR 9'(</8J)Q/)06=
(</8J)L%/806=''BB'&$8*2')A8'&*22%*38'28)"2/
M
A*/-$8?2%/)N8((*38(0:F'E%2()PQRF'(8&,/-PQR6=
V",$%,-',%,-$%G$C80,$%
"CI$J,%FEH%08%C$01L%
?'88$/%'#"A1/6%G-4W
O$J'A8$%9"8,%"B%,-$%
#$XA0#$/%BA1J,0"1'@0,4%
E0@@%C$%J"1,'01$/%01%,-$%
G$C80,$%J@'886
'% '%
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/ R"'@%"B%,-08%BA1J,0"1%08%,"%
! I690,62+"0" " ("#)&,K69#-G,.."C,. 41#!-9%# ?#01,%,-$%9$88'L$%-08,"#4%
!"#$%&'()*)%&'+,%-'A*/-$8?2%/)N8((*38(0>8#(%)8':F'%/) E%2()PQRF'%/) (8&,/-PQR6 C$,E$$1%,E"%?$"?@$
7
BB'P(%/3':<38)N8((*38(C,206F'!2%/)(')A8'.8((*3%/3'A%(),2;'#8):88/
BB')A8'?82(,/':%)A'E%2()PQR */-')A8'?82(,/':%)A'(8&,/-PQRF'%/')A8',2-82
BB')A,(8'.8((*38(':828'(8/)<
R$,%B0#8,%?$#8"1
?82(,/'*'9':<38)?82(,/W;PQR0E%2()PQR6=
%E'0*'99'/"$$6
7
1;()8.<,")<!2%/)$/0G?82(,/':%)A'"%- GXE%2()PQRXG'/,)'E,"/-F'&*/H)'!2%/)'.8((*38'A%(),2;G6=
M
?82(,/'#'9':<38)?82(,/W;PQR0(8&,/-PQR6=
%E'0#'99'/"$$6
R$,%8$J"1/%?$#8"1
7
1;()8.<,")<!2%/)$/0G?82(,/':%)A'"%- GX(8&,/-PQRXG'/,)'E,"/-F'&*/H)'!2%/)'.8((*38'A%(),2;G6=
M
1;()8.<,")<!2%/)$/0G1A,:%/3'&A*)'A%(),2;'#8):88/'4GX*<38)C%2()[*.806XG5'*/-'4GX#<38)C%2()[*.806XG5G6=
#,,$8*/ */;'9'E*$(8=
N8((*3845'.8((*38('9':<38)N8((*38(C,20E%2()PQR6=
E,20%/) % 9'\='% ]'.8((*38(<$8/3)A='%X9T6
R$,%YZZ%"B%,-$%9$88'L$8%
7
BB'@^R^'S ,/&8';,"'A*+8'%.!$8.8/)8-')A8'&,-8'%/'N8((*38<_*+*F'"/&,..8/)
B"#%B0#8,%?$#8"1%)01J@A/$8%
BB')A%('S %)':%$$'/,)'&,.!%$8'"/)%$')A8/<''`,"'.*;'/88-'),'&A*/38 9$88'L$8%E0,-%YV[\V.%
BB'(,.8',E')A8'.8)A,-'/*.8('"(8-'A828<
01%,-$%848,$92
BB'%E'0.8((*38(4%5<38)18/-8206<38)PQR06'a9'(8&,/-PQR bb
BB'''''.8((*38(4%5<38)c8&8%+8206<38)PQR06'a9'(8&,/-PQR6
BB'7
BB'''''&,/)%/"8=
'& BB'M '&
BB
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! I690,62+"0" " ("#)&,K69#-G,.."C,. 41#!-9%#
E,20%/) % 9'\='% ]'.8((*38(<$8/3)A='%X9T6
7 ;-08%@""?%E0@@%$>'901$%
BB'@^R^'S ,/&8';,"'A*+8'%.!$8.8/)8-')A8'&,-8'%/'N8((*38<_*+*F'"/&,..8/)
BB')A%('S %)':%$$'/,)'&,.!%$8'"/)%$')A8/<''`,"'.*;'/88-'),'&A*/38
$'J-%9$88'L$%,"%8$$%0B%
BB'(,.8',E')A8'.8)A,-'/*.8('"(8-'A828< $0,-$#%,-$%8$1/$#%"#%,-$%
BB'%E'0.8((*38(4%5<38)18/-8206<38)PQR06'a9'(8&,/-PQR bb V",%'%9',J-N%8"% #$J$0($#%"B%,-$%9$88'L$%
BB'''''.8((*38(4%5<38)c8&8%+8206<38)PQR06'a9'(8&,/-PQR6
BB'7 8]0?%,"%,-$%1$>,% 08%,-$%8$J"1/%?$#8"16
BB'''''&,/)%/"8=
BB'M
0,$#',0"1%"B%,-$%
BB
BB'*/;'9')2"8=
B"#%@""?6 G-4%08%,-08%1$$/$/W%
BB'1;()8.<,")<!2%/)$/0GY)'0G'X'.8((*38(4%5<38)?28));>A8/18/)06XG6F'GX O$J'A8$%E$%E'1,%,"%]$$?%
BB''''''''''''''''''''.8((*38(4%5<38)18/-8206<38)C"$$[*.806XG'(*%-D'dGG'X
BB''''''''''''''''''''.8((*38(4%5<38)N8((*38@8J)06'X'GdGG6= "1@4%9$88'L$8%C$,E$$1%
M
%E'0a*/;6 B0#8,%'1/%8$J"1/%?$#8"16
7
1;()8.<,")<!2%/)$/0G[^'NO11YZO'VQ1@^c`'C^P[R'C^c'@VO1O'@>^'P1Oc1<G6=
M
M
:8%'%9',J-N%8"%
?#01,%"A,%,-$%
9$88'L$
'( '(
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/ ;-08%BA1J,0"1%'//8%
8$($#'@%-'#/J"/$/%
! I690,62+"0" " "))K,%7&,L% 41#!-9%#
!"#$%&'()*)%&'+,%-'*--?8,!$8@,0>8#(%)8':6
?$"?@$%,"%,-$%G$C80,$%
7 "CI$J,%,-',%08%?'88$/%01%
BB'Y--',/8'!82(,/'),')A8'>8#(%)8<''`,"':%$$'$%K8$;'A*+8'),'&A*/38')A%(
BB'%E';,"'"!-*)8')A8'?82(,/'&,/()2"&),2< '8%'1%'#LA9$1,
BB'?82(,/'@Y'9'/8:'?82(,/0T\\TF'GeffGF'G@YG6=
?82(,/'@Y'9'/8:'?82(,/0T\\T6=
:<*--?82(,/0@Y6=
BB'Y--'(8+82*$',)A82'!8,!$8'),')A8':8#(%)8<
:<*--?82(,/0/8:'?82(,/0T\\e66= !#$',$%'%K$#8"1%"CI$J,%
:<*--?82(,/0/8:'?82(,/0T\\g66=
:<*--?82(,/0/8:'?82(,/0T\\h66= E0,-%,-$%:P%F*++*H
M
Y//%,-08%?$#8"1%,"%,-$%
E$C80,$
Y//%,-#$$%",-$#%?$#8"1%
"CI$J,8%E0,-%:P8%F*++<HN%
F*++^HN%'1/%F*++_H
)* )*
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/ ;-08%08%'%Q$88'L$%J@'88%8"%
,-',%Q$88'L$%"CI$J,8%J'1%
! G,.."C,2+"0"
!"#$%&'&$*(('N8((*38
C$%J#$',$/
7
!2%+*)8'?82(,/'(8/-82=
!2%+*)8'?82(,/'28&8%+82=
!2%+*)8'1)2%/3'.8((*38=
!2%+*)8'$,/3':A8/18/)=
!"#$%&'N8((*380?82(,/'(8/-82F'?82(,/'28&8%+82F'1)2%/3'.8((*38F'$,/3':A8/18/)6 Q$88'L$8%-"@/%,E"%
7
%E'0(8/-82'99'/"$$6 K$"?@$%"CI$J,8%)8$1/$#%
7
)A2,:'/8:'Q$$83*$Y23".8/)OJ&8!)%,/0G(8/-82'&*/'/,)'#8'/"$$'%/'N8((*38<N8((*3806G6=
'1/%#$J$0($#2N%,-$%
M
%E'028&8%+82'99'/"$$6
9$88'L$%8,#01LN%'1/%,-$%
7 ,09$%E-$1%,-$%9$88'L$%
)A2,:'/8:'Q$$83*$Y23".8/)OJ&8!)%,/0G28&8%+82'&*/'/,)'#8'/"$$'%/'N8((*38<N8((*3806G6=
M E'8%8$1,
%E'0(8/-82<38)PQR06'99'28&8%+82<38)PQR066
7
)A2,:'/8:'Q$$83*$Y23".8/)OJ&8!)%,/0G(8/-82'*/-'28&8%+82'&*/'/,)'#8')A8'(*.8'!82(,/'%/'N8((*38<N8((*3806G6=
M
)A%(<(8/-82 9'(8/-82=
)A%(<28&8%+82 9'28&8%+82=
)A%(<.8((*38 9'.8((*38=
)A%(<:A8/18/) 9':A8/18/)=
M
!"#$%&'1)2%/3'38)?28));>A8/18/)06
)' 7 )'
BB'@A%('%('*'E*/&;':*;',E'!2%/)%/3')A8'-*;'*/-')%.8'"(%/3'_*+*<)%.8<i'&$*((8(=
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/ ;-08%08%'%K$#8"1%J@'88%8"%
,-',%K$#8"1%"CI$J,8%J'1%
! K,6.%#2+"0"
!"#$%&'&$*(('?82(,/
C$%J#$',$/
7
BB'@^R^'S *--')A8',)A82'E%8$-('.8/)%,/8-'%/')A8'A*/-,")F'*/-'&28*)8
BB'38))82('*/-'(8))82('E,2'8*&A<
!2%+*)8'%/) "%-=
!"#$%&'?82(,/0%/) "%-6
7
(8)PQR0"%-6=
M Y//%,-$%'??#"?#0',$%
!"#$%&'%/) 38)PQR06 K$#8"1%B0$@/8%)018,'1J$%
7
28)"2/'"%-=
('#0'C@$82%-$#$
M
!"#$%&'+,%-'(8)PQR0%/) "%-6
7
)A%(<"%- 9'"%-=
M
!"#$%&'+,%-'(8/-N8((*38@,0?82(,/'28&8%+82F'1)2%/3'.8((*38F'$,/3':A8/F
>8#(%)8':8#(%)86
7
N8((*38'.'9'/8:'N8((*380)A%(F'28&8%+82F'.8((*38F':A8/6=
:8#(%)8<*--N8((*380.6=
M
!"#$%&'1)2%/3'38)C%2()[*.806
7
BB'@^R^'S )A%('%(',/8',E')A8'38))82(F'#")'%)'-,8(/H)
)) BB'-,')A8'2%3A)')A%/3'&"228/)$;<<< ))
28)"2/'G0P/%.!$8.8/)8-'N8)A,-6G=
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/ ;-$%G$C80,$%J@'88%E0@@%
'@@"E%4"A%,"%J#$',$%
! @,*.9-,2+"0" G$C80,$%"CI$J,8N%E-0J-%
!"#$%&'&$*(('>8#(%)8
7 E0@@%-"@/%'@@%"B%,-$%K$#8"1%
!2%+*)8'?82(,/45'"(82(=
"CI$J,8%'1/%Q$88'L$%
!"#$%&'>8#(%)806
7
"CI$J,8%01%,-$%848,$9
"(82('9'/8:'?82(,/4\5=
M
!"#$%&'+,%-'*--?82(,/0?82(,/'!6 !A##$1,@4N%"1@4%8,"#$8%'1%
7
BB'>8':%$$'/88-'),'&28*)8'*'/8:'?82(,/45'*22*;')A*)'%('T'.,28'%/'(%j8 '##'4%"B%K$#8"1%"CI$J,8
BB')A*/':A*)'k"(82(k'"(8-'),'#8F'*/-'&,!;')A8'&,/)8/)(',E'k"(82(k
BB'%/),'%)<
?82(,/'/8:Y22*;45'9'/8:'?82(,/4"(82(<$8/3)AXT5=
G-$1%'%1$E%G$C80,$%
E,20%/) % 9'\='% ]'"(82(<$8/3)A='%X9T6
7
"CI$J,%08%J#$',$/N%0,%8$,8%
/8:Y22*;4%5'9'"(82(4%5= HA8$#8H%,"%'1%$9?,4%
M
K$#8"1%'##'4%"B%@$1L,-%+
BB'@^R^'S *--'!'),'/8:P(82(F'*/-'"!-*)8'k"(82(k
M
!"#$%&'?82(,/'38)?82(,/W;PQR0%/) "%-6
7
BB'@^R^'S $,,!')A2,"3A'k"(82(kF'*/-'28)"2/')A8'E%2()'!82(,/':A,(8'"%-
BB'.*)&A8(<''^)A82:%(8F'28)"2/'/"$$'*('#8$,:<
28)"2/'/"$$=
M
)! +,%-'*--N8((*380N8((*38'.6 )!
7
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! @,*.9-,2+"0"
!"#$%&'+,%-'*--?82(,/0?82(,/'!6
5-"A@/%'//%'%K$#8"1%"CI$J,%,"%,-$%
7
BB'>8':%$$'/88-'),'&28*)8'*'/8:'?82(,/45'*22*;')A*)'%('T'.,28'%/'(%j8
FA8$#8H%018,'1J$%('#0'C@$N%E-0J-%08%'1%
BB')A*/':A*)'k"(82(k'"(8-'),'#8F'*/-'&,!;')A8'&,/)8/)(',E'k"(82(k '##'46%;"%/"%,-08N%E$%J#$',$%'%1$E%
BB'%/),'%)<
?82(,/'/8:Y22*;45'9'/8:'?82(,/4"(82(<$8/3)AXT5= '##'4%"B%0,8%JA##$1,%@$1L,-%`%*6%G$%
E,20%/) % 9'\='% ]'"(82(<$8/3)A='%X9T6
7 ,-$1%J"?4%"($#%,-$%$@$9$1,8%B#"9%
M
/8:Y22*;4%5'9'"(82(4%5=
,-$%$>08,01L%'##'4%,"%,-$%1$E%'##'46%
BB'@^R^'S *--'!'),'/8:P(82(F'*/-'"!-*)8'k"(82(k
;-$%#$8,%08%B"#%4"A%,"%B0108-a
M
5-"A@/%@""?%,-#"AL-%,-$%FA8$#8H%
!"#$%&'?82(,/'38)?82(,/W;PQR0%/) "%-6
7 '##'4N%,-$1%#$,A#1%,-$%K$#8"1%"CI$J,%
BB'@^R^'S $,,!')A2,"3A'k"(82(kF'*/-'28)"2/')A8'E%2()'!82(,/':A,(8'"%-
BB'.*)&A8(<''^)A82:%(8F'28)"2/'/"$$'*('#8$,:< ,-',%9',J-$8%FA0/H
28)"2/'/"$$=
M
Y//%'%Q$88'L$%"CI$J,%,"%'%9$88'L$8%
+,%-'*--N8((*380N8((*38'.6
7
'##'4%)E-0J-%/"$81S,%$>08,N%4"A%1$$/%
BB'@^R^'S -8&%-8'A,:'),'(),28'.F'(,')A*)';,"'&*/'$*)82'28)2%8+8')A8 ,"%J#$',$%0,26%P"%,-08%01%,-$%8'9$%E'4%
BB'2%3A)',/8('%/'38)N8((*38(C,206<
M '8%'//01L%'%K$#8"1%"CI$J,%01%
!"#$%&'N8((*3845'38)N8((*38(C,20%/) "%-6 F'//K$#8"1H
7
BB'@^R^'S 28)"2/'*$$'.8((*38('*--8-',/')A8'>8#(%)8':A828'8%)A82
)" BB')A8'(8/-82',2')A8'28&8%+82':*(')A8'!82(,/':%)A'"%- k"%-kF'%/ )"
BB')A8',2-82')A8;':828'(8/)<
LAB 3
1'0/23$"'0)$+/)/4%3$%'5)3$"2$/2)6&0/
! @,*.9-,2+"0" Z""?%,-#"AL-%,-$%9$88'L$8%'##'46%
!"#$%&'N8((*3845'38)N8((*38(C,20%/) "%-6
!-$J]%0B%$'J-%9$88'L$%$0,-$#%-'8%'%
7 8$1/$#%\U%#$J$0($#%,-',%9',J-$8%
BB'@^R^'S 28)"2/'*$$'.8((*38('*--8-',/')A8'>8#(%)8':A828'8%)A82
BB')A8'(8/-82',2')A8'28&8%+82':*(')A8'!82(,/':%)A'"%- k"%-kF'%/ FA0/H6%:B%8"N%'//%,-',%9$88'L$%,"%'1%
BB')A8',2-82')A8;':828'(8/)<
28)"2/'/8:'N8((*384\5= Y##'4Z08,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W$41#!-9%#$9#$366"'Q9.-2
)% )%
LAB 3
7&0%8,)/4%3$%'5)6."33/3)$&)"00)2/9#%2/0)8#'6$%&'".%$,)
! J9#-.;
! I690,62+"0"
! A7)"-,$V"))K,%7&,L%W$.%$-("-$,"!($K,6.%#$%*+,!-$9.$*,9#C$
!%#.-61!-,)$59-($"$496.-$#":,$"#)$&".-$#":,$9#$"))9-9%#$-%$"#$
UI
! A#!%::,#-$-(,$!%),$9#$V("#)&,K69#-G,.."C,.W
! 8("#C,$-(,$&9#,$9#$V("#)&,K69#-G,.."C,.W$-("-$769#-.$%1-$
VM(%59#C$!("-$(9.-%6'$*,-5,,#222W$-%$769#-$%1-$-(,$41&&$#":,.
)& )&
EXERCISE
!"#$%#&'(&$)#$*&$+*&*(&,)#&-#.,/0#&12&34#0.5%#6
)( )(