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
17
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
53
Collections Framework Begineers Guide 2
khasunuma
0
55
Introduction to Date and Time API 4
khasunuma
0
50
Other Decks in Programming
See All in Programming
CSC509 Lecture 11
javiergs
PRO
0
180
Macとオーディオ再生 2024/11/02
yusukeito
0
370
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Jakarta EE meets AI
ivargrimstad
0
610
役立つログに取り組もう
irof
28
9.6k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
Realtime API 入門
riofujimon
0
150
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Adopting Sorbet at Scale
ufuk
73
9.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
GitHub's CSS Performance
jonrohan
1030
460k
Agile that works and the tools we love
rasmusluckow
327
21k
Designing for Performance
lara
604
68k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Practical Orchestrator
shlominoach
186
10k
Teambox: Starting and Learning
jrom
133
8.8k
Done Done
chrislema
181
16k
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