$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Fundamental Java
Search
HASUNUMA Kenji
April 20, 2016
Programming
0
28
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
46
Life of our small product
khasunuma
0
34
How to adapt MicroProfile API for generic Web applications
khasunuma
0
31
Overviewing Admin Console
khasunuma
0
30
Introduction to MicroProfile Metrics
khasunuma
0
52
Basic method for Java EE Web Profile
khasunuma
0
28
Introduction to JCA and MDB
khasunuma
0
72
Collections Framework Begineers Guide 2
khasunuma
0
64
JLS myths ~ if-then-else statement ~
khasunuma
0
33
Other Decks in Programming
See All in Programming
イベントストーミングのはじめかた / Getting Started with Event Storming
nrslib
1
770
connect-python: convenient protobuf RPC for Python
anuraaga
0
310
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
24
19k
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
2.9k
jakarta-security-jjug-ccc-2025-fall
tnagao7
0
100
分散DBって何者なんだ... Spannerから学ぶRDBとの違い
iwashi623
0
140
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
13
5.5k
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
180
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
180
Atomics APIを知る / Understanding Atomics API
ssssota
1
230
目的で駆動する、AI時代のアーキテクチャ設計 / purpose-driven-architecture
minodriven
11
3.7k
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
14
14k
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
RailsConf 2023
tenderlove
30
1.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Docker and Python
trallard
46
3.7k
A better future with KSS
kneath
239
18k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
4 Signs Your Business is Dying
shpigford
186
22k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
GitHub's CSS Performance
jonrohan
1032
470k
Music & Morning Musume
bryan
46
7k
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