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
26
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
39
Life of our small product
khasunuma
0
27
How to adapt MicroProfile API for generic Web applications
khasunuma
0
28
Overviewing Admin Console
khasunuma
0
27
Introduction to MicroProfile Metrics
khasunuma
0
47
Basic method for Java EE Web Profile
khasunuma
0
22
Introduction to JCA and MDB
khasunuma
0
62
Collections Framework Begineers Guide 2
khasunuma
0
61
Introduction to Date and Time API 4
khasunuma
0
56
Other Decks in Programming
See All in Programming
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
46
31k
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
390
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
420
NPOでのDevinの活用
codeforeveryone
0
330
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
550
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
890
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
470
Java on Azure で LangGraph!
kohei3110
0
170
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
A2A プロトコルを試してみる
azukiazusa1
2
1.2k
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
230
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
160
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
14k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Making Projects Easy
brettharned
116
6.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Music & Morning Musume
bryan
46
6.6k
Raft: Consensus for Rubyists
vanstee
140
7k
A better future with KSS
kneath
239
17k
Into the Great Unknown - MozCon
thekraken
39
1.9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
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