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
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Quine, Polyglot, 良いコード
qnighy
4
640
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Jakarta EE meets AI
ivargrimstad
0
650
役立つログに取り組もう
irof
28
9.6k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
950
Jakarta EE meets AI
ivargrimstad
0
580
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Featured
See All Featured
How GitHub (no longer) Works
holman
310
140k
The Cult of Friendly URLs
andyhume
78
6k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Thoughts on Productivity
jonyablonski
67
4.3k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
GitHub's CSS Performance
jonrohan
1030
460k
How to train your dragon (web standard)
notwaldorf
88
5.7k
BBQ
matthewcrist
85
9.3k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
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