Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
33
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
46
Life of our small product
khasunuma
0
34
How to adapt MicroProfile API for generic Web applications
khasunuma
0
31
Overviewing Admin Console
khasunuma
0
30
Introduction to MicroProfile Metrics
khasunuma
0
53
Basic method for Java EE Web Profile
khasunuma
0
28
Introduction to JCA and MDB
khasunuma
0
74
Collections Framework Begineers Guide 2
khasunuma
0
64
Introduction to Date and Time API 4
khasunuma
0
64
Other Decks in Programming
See All in Programming
2025 컴포즈 마법사
jisungbin
0
170
React Native New Architecture 移行実践報告
taminif
1
130
目的で駆動する、AI時代のアーキテクチャ設計 / purpose-driven-architecture
minodriven
11
3.8k
AWS CDKの推しポイントN選
akihisaikeda
1
230
CSC305 Lecture 15
javiergs
PRO
0
220
モダンJSフレームワークのビルドプロセス 〜なぜReactは503行、Svelteは12行なのか〜
fuuki12
0
170
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
17k
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
14
14k
Module Harmony
petamoriken
2
600
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.1k
jakarta-security-jjug-ccc-2025-fall
tnagao7
0
110
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
260
Featured
See All Featured
Side Projects
sachag
455
43k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Music & Morning Musume
bryan
46
7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
Rails Girls Zürich Keynote
gr2m
95
14k
Fireside Chat
paigeccino
41
3.7k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Mobile First: as difficult as doing things right
swwweet
225
10k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Building Adaptive Systems
keathley
44
2.8k
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