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
18
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
33
Life of our small product
khasunuma
0
17
How to adapt MicroProfile API for generic Web applications
khasunuma
0
18
Overviewing Admin Console
khasunuma
0
18
Introduction to MicroProfile Metrics
khasunuma
0
40
Basic method for Java EE Web Profile
khasunuma
0
17
Introduction to JCA and MDB
khasunuma
0
49
Collections Framework Begineers Guide 2
khasunuma
0
55
Introduction to Date and Time API 4
khasunuma
0
47
Other Decks in Programming
See All in Programming
GoのIteratorに詳しくなってしまう
inatonix
1
200
REXML改善のその後
naitoh
0
190
Shinjuku.rb#95:心の技術書紹介
free_world21
1
110
XStateでReactに秩序を与えたい
gizm000
0
730
Why Prism?
kddnewton
4
1.7k
unique パッケージから学ぶ interning と weak reference @ Asakusa.go#3
karamaru
2
810
マルチモジュールにおけるテスト最適化
fxwx23
0
210
The Sequel to a Dream of Ruby Parser's Grammar
ydah
1
220
長期運用プロダクトの開発速度を維持し続けるためのリファクタリング実践例
wataruss
8
2.7k
Ebitengineの1vs1ゲーム WebRTCの活用
ponyo877
0
380
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
270
GenU導入でCDKに初挑戦し、悪戦苦闘した話
hideg
0
160
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Principles of Awesome APIs and How to Build Them.
keavy
125
16k
Visualization
eitanlees
142
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
123
18k
Intergalactic Javascript Robots from Outer Space
tanoku
268
26k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
48
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
89
16k
Why You Should Never Use an ORM
jnunemaker
PRO
53
8.9k
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