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
JLS myths ~ if-then-else statement ~
Search
HASUNUMA Kenji
October 01, 2016
Programming
0
22
JLS myths ~ if-then-else statement ~
HASUNUMA Kenji
October 01, 2016
Tweet
Share
More Decks by HASUNUMA Kenji
See All by HASUNUMA Kenji
Jakarta EE: The First Parts
khasunuma
0
37
Life of our small product
khasunuma
0
19
How to adapt MicroProfile API for generic Web applications
khasunuma
0
24
Overviewing Admin Console
khasunuma
0
21
Introduction to MicroProfile Metrics
khasunuma
0
45
Basic method for Java EE Web Profile
khasunuma
0
22
Introduction to JCA and MDB
khasunuma
0
59
Collections Framework Begineers Guide 2
khasunuma
0
59
Introduction to Date and Time API 4
khasunuma
0
54
Other Decks in Programming
See All in Programming
gen_statem - OTP's Unsung Hero
whatyouhide
1
180
英語文法から学ぶ、クリーンな設計の秘訣
newnomad
1
280
パスキーのすべて / 20250324 iddance Lesson.5
kuralab
0
140
snacks.nvim内のセットアップ不要なプラグインを紹介 / introduce_snacks_nvim
uhooi
0
370
Kubernetesで実現できるPlatform Engineering の現在地
nwiizo
3
1.8k
ローコードサービスの進化のためのモノレポ移行
taro28
1
350
Rollupのビルド時間高速化によるプレビュー表示速度改善とバンドラとASTを駆使したプロダクト開発の難しさ
plaidtech
PRO
1
110
AI時代のプログラミング教育 / programming education in ai era
kishida
23
21k
SQL Server ベクトル検索
odashinsuke
0
140
SLI/SLOの設定を進めるその前に アラート品質の改善に取り組んだ話
tanden
2
770
本当だってば!俺もTRICK 2022に入賞してたんだってば!
jinroq
0
270
英語 × の私が、生成AIの力を借りて、OSSに初コントリビュートした話
personabb
0
160
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.4k
Scaling GitHub
holman
459
140k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Become a Pro
speakerdeck
PRO
27
5.2k
Code Reviewing Like a Champion
maltzj
522
39k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Building Adaptive Systems
keathley
41
2.5k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.6k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Transcript
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