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
27
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
40
Life of our small product
khasunuma
0
28
How to adapt MicroProfile API for generic Web applications
khasunuma
0
29
Overviewing Admin Console
khasunuma
0
28
Introduction to MicroProfile Metrics
khasunuma
0
48
Basic method for Java EE Web Profile
khasunuma
0
23
Introduction to JCA and MDB
khasunuma
0
66
Collections Framework Begineers Guide 2
khasunuma
0
63
Introduction to Date and Time API 4
khasunuma
0
59
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
290
MLH State of the League: 2026 Season
theycallmeswift
0
210
CSC305 Summer Lecture 12
javiergs
PRO
0
130
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
120
More Approvers for Greater OSS and Japan Community
tkikuc
1
110
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
110
AIエージェント開発、DevOps and LLMOps
ymd65536
1
370
AIコーディングAgentとの向き合い方
eycjur
0
250
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
1
200
フロントエンドのmonorepo化と責務分離のリアーキテクト
kajitack
2
150
Namespace and Its Future
tagomoris
6
680
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.9k
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
140
7.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
11
1.1k
Typedesign – Prime Four
hannesfritz
42
2.8k
RailsConf 2023
tenderlove
30
1.2k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
510
KATA
mclloyd
32
14k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Writing Fast Ruby
sferik
628
62k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
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