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
64
Collections Framework Begineers Guide 2
khasunuma
0
62
Introduction to Date and Time API 4
khasunuma
0
58
Other Decks in Programming
See All in Programming
ZeroETLで始めるDynamoDBとS3の連携
afooooil
0
160
AHC051解法紹介
eijirou
0
430
Dart 参戦!!静的型付き言語界の隠れた実力者
kno3a87
0
190
iOS開発スターターキットの作り方
akidon0000
0
240
Scale out your Claude Code ~自社専用Agentで10xする開発プロセス~
yukukotani
9
1.9k
MCP連携で加速するAI駆動開発/mcp integration accelerates ai-driven-development
bpstudy
0
290
대규모 트래픽을 처리하는 프론트 개발자의 전략
maryang
0
120
自作OSでDOOMを動かしてみた
zakki0925224
1
1.3k
Gemini CLIの"強み"を知る! Gemini CLIとClaude Codeを比較してみた!
kotahisafuru
3
970
バイブスあるコーディングで ~PHP~ 便利ツールをつくるプラクティス
uzulla
1
330
CLI ツールを Go ライブラリ として再実装する理由 / Why reimplement a CLI tool as a Go library
ktr_0731
3
1.1k
ゲームの物理
fadis
4
1k
Featured
See All Featured
Embracing the Ebb and Flow
colly
86
4.8k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
800
Designing for humans not robots
tammielis
253
25k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
Agile that works and the tools we love
rasmusluckow
329
21k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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