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
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Arm移行タイムアタック
qnighy
0
330
RubyLSPのマルチバイト文字対応
notfounds
0
120
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
初めてDefinitelyTypedにPRを出した話
syumai
0
420
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Ethereum_.pdf
nekomatu
0
460
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
Realtime API 入門
riofujimon
0
150
最新TCAキャッチアップ
0si43
0
180
C++でシェーダを書く
fadis
6
4.1k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Thoughts on Productivity
jonyablonski
67
4.3k
Producing Creativity
orderedlist
PRO
341
39k
Building an army of robots
kneath
302
43k
Building Your Own Lightsaber
phodgson
103
6.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Documentation Writing (for coders)
carmenintech
65
4.4k
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