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
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
42 best practices for Symfony, a decade later
tucksaun
1
180
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
Haze - Real time background blurring
chrisbanes
1
510
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
2
200
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
Zoneless Testing
rainerhahnekamp
0
120
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
How STYLIGHT went responsive
nonsquared
95
5.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
RailsConf 2023
tenderlove
29
940
Typedesign – Prime Four
hannesfritz
40
2.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Gamification - CAS2011
davidbonilla
80
5.1k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
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