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
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
370
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
970
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
2
520
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.2k
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
190
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
800
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
130
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
710
Оптимизируем производительность блока Казначейство
lamodatech
0
800
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
100
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.2k
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
180
Featured
See All Featured
A designer walks into a library…
pauljervisheath
205
24k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
A better future with KSS
kneath
238
17k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Six Lessons from altMBA
skipperchong
27
3.5k
The Invisible Side of Design
smashingmag
299
50k
Visualization
eitanlees
146
15k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
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