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
23
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
25
Overviewing Admin Console
khasunuma
0
22
Introduction to MicroProfile Metrics
khasunuma
0
46
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
55
Other Decks in Programming
See All in Programming
七輪ライブラリー: Claude AI で作る Next.js アプリ
suneo3476
1
130
SwiftDataのカスタムデータストアを試してみた
1mash0
0
130
メモリウォールを超えて:キャッシュメモリ技術の進歩
kawayu
0
1.9k
Dissecting and Reconstructing Ruby Syntactic Structures
ydah
2
1.3k
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
9
3.2k
これだけは知っておきたいクラス設計の基礎知識 version 2
masuda220
PRO
24
6.6k
AIコーディングの理想と現実
tomohisa
33
35k
監視 やばい
syossan27
11
10k
Vibe Coding の話をしよう
schroneko
12
3.1k
Youtube Lofier - Chrome拡張開発
ninikoko
0
2.5k
fieldalignmentから見るGoの構造体
kuro_kurorrr
0
120
「影響が少ない」を自分の目でみてみる
o0h
PRO
2
1.2k
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
23
1.5k
Designing for Performance
lara
608
69k
The Pragmatic Product Professional
lauravandoore
33
6.6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
GraphQLの誤解/rethinking-graphql
sonatard
71
10k
Scaling GitHub
holman
459
140k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
A Tale of Four Properties
chriscoyier
158
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
41
2.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
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