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
27
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
40
Life of our small product
khasunuma
0
28
How to adapt MicroProfile API for generic Web applications
khasunuma
0
29
Overviewing Admin Console
khasunuma
0
28
Introduction to MicroProfile Metrics
khasunuma
0
48
Basic method for Java EE Web Profile
khasunuma
0
24
Introduction to JCA and MDB
khasunuma
0
66
Collections Framework Begineers Guide 2
khasunuma
0
63
Introduction to Date and Time API 4
khasunuma
0
59
Other Decks in Programming
See All in Programming
Kiroで始めるAI-DLC
kaonash
2
580
Navigating Dependency Injection with Metro
zacsweers
3
260
Laravel Boost 超入門
fire_arlo
3
210
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
240
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
個人軟體時代
ethanhuang13
0
320
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
320
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
190
AI時代のUIはどこへ行く?
yusukebe
18
8.8k
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
The Past, Present, and Future of Enterprise Java with ASF in the Middle
ivargrimstad
0
100
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
320
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
696
190k
Making Projects Easy
brettharned
117
6.4k
Statistics for Hackers
jakevdp
799
220k
Making the Leap to Tech Lead
cromwellryan
135
9.5k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Writing Fast Ruby
sferik
628
62k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
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