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
40
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
53
Life of our small product
khasunuma
0
39
How to adapt MicroProfile API for generic Web applications
khasunuma
0
38
Overviewing Admin Console
khasunuma
0
36
Introduction to MicroProfile Metrics
khasunuma
0
59
Basic method for Java EE Web Profile
khasunuma
0
35
Introduction to JCA and MDB
khasunuma
0
86
Collections Framework Begineers Guide 2
khasunuma
0
76
Introduction to Date and Time API 4
khasunuma
0
70
Other Decks in Programming
See All in Programming
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
2
920
オブザーバビリティ駆動開発って実際どうなの?
yohfee
1
400
並行開発のためのコードレビュー
miyukiw
2
2k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
230
Scaling & Coordinating AI Agents for Development - Tamir Dresher
tamirdresher
0
110
15年目のiOSアプリを1から作り直す技術
teakun
0
500
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
440
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
22
8k
2026/02/04 AIキャラクター人格の実装論 口 調の模倣から、コンテキスト制御による 『思想』と『行動』の創発へ
sr2mg4
0
610
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
310
株式会社 Sun terras カンパニーデック
sunterras
0
1.8k
atmaCup #23でAIコーディングを活用した話
ml_bear
4
680
Featured
See All Featured
Thoughts on Productivity
jonyablonski
75
5.1k
Exploring anti-patterns in Rails
aemeredith
2
280
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Documentation Writing (for coders)
carmenintech
77
5.3k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
Crafting Experiences
bethany
1
65
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Test your architecture with Archunit
thirion
1
2.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
370
Product Roadmaps are Hard
iamctodd
PRO
55
12k
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