Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JLS myths ~ if-then-else statement ~
Search
HASUNUMA Kenji
October 01, 2016
Programming
85
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JLS myths ~ if-then-else statement ~
HASUNUMA Kenji
October 01, 2016
Transcript
10 slides
JLS myths ~ if-then-else statement ~ HASUNUMA Kenji
[email protected]
GlassFish
Users Group Japan
if-else statement if ( someObject.eval() ) if ( otherObject.eval() )
func1(); else func2(); assume that someObject.eval() is false. which is run, func1 or func2?
if-else statement if ( someObject.eval() ) if ( otherObject.eval() )
func1(); else func2(); assume that someObject.eval() is false. Neither func1 nor func2 is run.
if-else statement if ( someObject.eval() ) if ( otherObject.eval() )
func1(); else func2(); It's if-else's short-circuit. Don't be misled by source code format!
From JLS (Java SE 8) IfThenStatement: if ( Expression )
Statement IfThenElseStatement: if ( Expression ) StatementNoShortIf else Statement IfThenElseStatementNoShortIf: if ( Expression ) StatementNoShortIf else StatementNoShortIf
Statement Statement: StatementWithoutTrailingSubstatement LabeledStatement IfThenStatement IfThenElseStatement WhileStatement ForStatement
StatementNoShortIf StatementNoShortIf: StatementWithoutTrailingSubstatement LabeledStatementNoShortIf IfThenElseStatementNoShortIf WhileStatementNoShortIf ForStatementNoShortIf *** 'IfThenStatementNoShortIf' don't
exist ***
if-else statement (fixed) if ( someObject.eval() ) { if (
otherObject.eval() ) func1(); } else func2(); assume that someObject.eval() is false. which is run, func1 or func2?
if-else statement (fixed) if ( someObject.eval() ) { if (
otherObject.eval() ) func1(); } else func2(); func2 is run! because it use block as statement in outer if statement
JLS myths ~ If-then-else statement ~ HASUNUMA Kenji
[email protected]
GlassFish
Users Group Japan
More Decks by HASUNUMA Kenji
See All by HASUNUMA Kenji
Jakarta EE: The First Parts
khasunuma
0
82
Life of our small product
khasunuma
0
58
How to adapt MicroProfile API for generic Web applications
khasunuma
0
66
Overviewing Admin Console
khasunuma
0
56
Introduction to MicroProfile Metrics
khasunuma
0
92
Basic method for Java EE Web Profile
khasunuma
0
59
Introduction to JCA and MDB
khasunuma
0
120
Collections Framework Begineers Guide 2
khasunuma
0
120
Introduction to Date and Time API 4
khasunuma
0
130
Other Decks in Programming
See All in Programming
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
120
AI Augmentation Techniques with Liberty
ivargrimstad
1
560
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
Debian JP Projectのサーバー構成
uwabami
1
180
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
390
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
190
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
180
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
510
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
170
手の動かし方がわからなかった私が個人開発者になるまで
usagi0920_pochi
0
340
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
440
Featured
See All Featured
Building AI with AI
inesmontani
PRO
1
1.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Designing Powerful Visuals for Engaging Learning
tmiket
1
660
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
580
WENDY [Excerpt]
tessaabrams
15
41k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
A Tale of Four Properties
chriscoyier
163
24k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.8k
Navigating Team Friction
lara
192
16k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
650