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
63
0
Share
JLS myths ~ if-then-else statement ~
HASUNUMA Kenji
October 01, 2016
More Decks by HASUNUMA Kenji
See All by HASUNUMA Kenji
Jakarta EE: The First Parts
khasunuma
0
61
Life of our small product
khasunuma
0
47
How to adapt MicroProfile API for generic Web applications
khasunuma
0
45
Overviewing Admin Console
khasunuma
0
45
Introduction to MicroProfile Metrics
khasunuma
0
69
Basic method for Java EE Web Profile
khasunuma
0
43
Introduction to JCA and MDB
khasunuma
0
96
Collections Framework Begineers Guide 2
khasunuma
0
86
Introduction to Date and Time API 4
khasunuma
0
79
Other Decks in Programming
See All in Programming
自動レビューエンジンの実装と運用 ~レビューのない世界へ~
kurukuru1999
2
310
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
7
1.3k
Lessons from Spec-Driven Development
simas
PRO
0
110
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
260
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
0
130
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
2
1.5k
OSもどきOS
arkw
0
380
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
3
1.9k
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1.1k
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
2.9k
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
140
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
120
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
160
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
Google's AI Overviews - The New Search
badams
0
1k
Building AI with AI
inesmontani
PRO
1
1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
200
Fireside Chat
paigeccino
42
3.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
860
Navigating Weather and Climate Data
rabernat
0
210
My Coaching Mixtape
mlcsv
0
140
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