Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Fundamental Java
Search
HASUNUMA Kenji
April 20, 2016
Programming
0
18
Fundamental Java
HASUNUMA Kenji
April 20, 2016
Tweet
Share
More Decks by HASUNUMA Kenji
See All by HASUNUMA Kenji
Jakarta EE: The First Parts
khasunuma
0
35
Life of our small product
khasunuma
0
17
How to adapt MicroProfile API for generic Web applications
khasunuma
0
21
Overviewing Admin Console
khasunuma
0
19
Introduction to MicroProfile Metrics
khasunuma
0
42
Basic method for Java EE Web Profile
khasunuma
0
19
Introduction to JCA and MDB
khasunuma
0
53
Collections Framework Begineers Guide 2
khasunuma
0
55
JLS myths ~ if-then-else statement ~
khasunuma
0
19
Other Decks in Programming
See All in Programming
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
180
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
RubyLSPのマルチバイト文字対応
notfounds
0
120
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
CSC509 Lecture 11
javiergs
PRO
0
180
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
Why Our Code Smells
bkeepers
PRO
334
57k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Happy Clients
brianwarren
98
6.7k
4 Signs Your Business is Dying
shpigford
180
21k
Unsuck your backbone
ammeep
668
57k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Rails Girls Zürich Keynote
gr2m
94
13k
Transcript
Fundamental Java HASUNUMA Kenji Vice president, GlassFish Users Group Japan
[email protected]
Twitter: @btnrouge
What’s Java?
Javaͷಛ • Φʔϓϯͳن֨Ͱ͋Δ • ৗʹਐԽ͍ͯ͠Δ • ޓੑΛॏࢹ͍ͯ͠Δ
JavaΦʔϓϯن֨ • ݴޠɺඪ४APIɺԾϚγϯ༷ • Java Community ProcessͰඪ४Խ • ݱࡏΦʔϓϯιʔε (GPLv2)
wWrite Once, Run Anywhere wݴޠϨϕϧͰϚϧνεϨουରԠ wݫ֨ͳྫ֎ॲཧػߏ w6OJDPEFΛશ໘తʹ࠾༻
Write Once, Run Anywhere • OSɺJava VM࣮ʹґଘ͠ͳ͍ • ݹ͍ίʔυ͕࠷৽ͷJavaͰಈ͘ •
Blu-ray͔ΒڊେγεςϜ·Ͱ
ॳ04ͷࠩҟΛ+BWB7.͕ٵऩ͢Δ ݱࡏ+BWB7.͕ଟݴޠͷڞ௨ج൫
Essential Java
JavaͷΤίγεςϜ
ΫϥεͱΠϯλϑΣʔε
!
! Ϋϥεͷܧঝ
" #
" Polymorphismͱ
$%& '&( ( )&%%%
ϓϩηεͱεϨου
$%& '&( ( )&%%%
$%* $%* $%* + + ϓϩηεͱεϨου
, "- # ./0 , 0 #- ./0 " " " " " " -""1 +BWBͷೖग़ྗ 4USFBN ݱࡏͰจࣈྻσʔλʹಛԽͨ͠3FBEFS8SJUFSɺ ߴ*0Λ࣮ݱ͢Δ$IBOOFMΑ͘ΘΕ͍ͯΔ
+BWBͷύοέʔδ
Ϋϥε໊ͷදهํ๏ wݪଇύοέʔδΛؚΉશ໊ ྫ java.util.List wimportએݴಛఆͷύοέʔδΛলུՄ ํ๏ import java.util.List; ํ๏ import
java.util.*; wjava.langʜৗʹύοέʔδΛলུՄ
+BWBΫϥεͷಉҰੑ • Ϋϥε໊͕ಉҰͰ͋Δ • ύοέʔδ໊͕શʹҰக͍ͯ͠Δ • ಉ͡Ϋϥεϩʔμʔ͔ΒಡΈࠐ·Εͨ
Java Core Parts
ΫϥεͱΦϒδΣΫτ • ΫϥεఆٛͷΈ…࣮ମ͕ͳ͍ • ΦϒδΣΫτ(Πϯελϯε) …Ϋϥε͔Β࡞࣮ͨ͠ମͷ͜ͱ • ϑΟʔϧυͱϝιουΦϒδΣΫτʹ ଐ͢Δ(㱻staticΫϥεʹଐ͢Δ)
java.lang.Object • JavaͷશΫϥεͷεʔύʔΫϥε • ΫϥεͷࠜװʹؔΘΔϝιουΛ࣋ͭ • ϓϦϛςΟϒܕʹରͯ͠ϦϑΝϨϯεܕ ͱݺΕΔ͜ͱ͋Δ
java.lang.Object ͷϝιου equals ಉҰνΣοΫʹ͏ ※ݪଇͱͯ͠ΦʔόʔϥΠυ͢Δ hashCode toString จࣈྻදݱΛฦ͢ ※༻్༷ʑ wait
εϨου੍ޚ༻ϝιου ※௨ৗConcurrency UtilitiesΛܦ༝ ͯ͠༻͢Δ(ΦʔόʔϥΠυෆՄ) notify notifyAll clone ίϐʔ(࠷ۙΘΕͳ͍) finalize ޙॲཧ(௨ৗΦʔόʔϥΠυ͠ͳ͍)
Object o = new Object();
Object o = new Object();
Object o = new Object(); ӈลͱಉ͡Ϋϥε PS εʔύʔΫϥε PS ࣮ΠϯλϑΣʔε
Object o = new ArrayList();
Ωϟετ Object o = new ArrayList(); • objͷఆٛObjectɺ࣮ମArrayList • ΞΫηεఆٛΛ௨ͯ͡ߦ͏
• ࣮ମͷΞΫηεˠΩϟετ ArrayList list = (ArrayList) o; w Ωϟετ=αϒΫϥεͷఆٛͰΞΫηε w Ωϟετޙ࣮ମʹΞΫηεՄೳ
ϓϦϛςΟϒܕ • ΫϥεͰͳ͍σʔλܕ • ରԠ͢ΔΫϥε(ϥούʔ)Λ࣋ͭ • auto-boxing/unboxing: ϓϦϛςΟϒܕͱϥούʔͷ૬ޓม
ϓϦϛςΟϒܕ ϥούʔΫϥε boolean Boolean byte Byte char Character short Short
int Integer long Long float Float double Double
ྻ • ಉ͡ΫϥεorϓϦϛςΟϒܕͷ࿈ଓ • ԋࢉࢠ [ ] ͰཁૉʹΞΫηε͢Δ • ෦తʹjava.lang.ArrayΫϥε
Object[ ] o = new Object[8]; P0CKFDUͷྻ ཁૉࢦఆ͠ͳ͍ ྻͷཁૉ ඞͣఆޙͰมߋෆՄ
ྻͷ߹ɺࠨลͱӈลಉ͡Ϋϥε
ͦͷଞͷॏཁͳτϐοΫ • Generics (J2SE 5.0) • Annotation (J2SE 5.0) •
Project Coin (Java SE 7) • Collections Framework (J2SE 1.2) • New I/O (J2SE 1.4 & Java SE 7) • Concurrency Utilitites (J2SE 5.0 & Java SE 7)
Fundamental Java HASUNUMA Kenji
[email protected]
Twitter: @btnrouge