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
19
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
35
Life of our small product
khasunuma
0
18
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
56
Collections Framework Begineers Guide 2
khasunuma
0
56
Introduction to Date and Time API 4
khasunuma
0
51
Other Decks in Programming
See All in Programming
GAEログのコスト削減
mot_techtalk
0
120
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.2k
Spring gRPC について / About Spring gRPC
mackey0225
0
220
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
310
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
220
Grafana Loki によるサーバログのコスト削減
mot_techtalk
1
130
Unity Android XR入門
sakutama_11
0
160
GoとPHPのインターフェイスの違い
shimabox
2
180
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
560
Amazon S3 TablesとAmazon S3 Metadataを触ってみた / 20250201-jawsug-tochigi-s3tables-s3metadata
kasacchiful
0
160
Conform を推す - Advocating for Conform
mizoguchicoji
3
690
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
137
6.8k
Code Reviewing Like a Champion
maltzj
521
39k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
KATA
mclloyd
29
14k
The Language of Interfaces
destraynor
156
24k
Why Our Code Smells
bkeepers
PRO
336
57k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Designing Experiences People Love
moore
140
23k
Designing for Performance
lara
604
68k
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