[HD-OCP17/21-Fundamentals Pg 0, Sec. 12.3.3 - which-switch-syntax-to-use-old-or-new]

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
joaoclopes
Posts: 26
Joined: Mon Sep 23, 2024 4:49 pm
Contact:

[HD-OCP17/21-Fundamentals Pg 0, Sec. 12.3.3 - which-switch-syntax-to-use-old-or-new]

Post by joaoclopes »

Hello!

Regarding the new syntax and old syntax of switch statement is quoted
You can do all the things with either of the syntaxes.
You can't do the fall through behavior in the new syntax for example.

Thanks!
João

admin
Site Admin
Posts: 10326
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: [HD-OCP17/21-Fundamentals Pg 0, Sec. 12.3.3 - which-switch-syntax-to-use-old-or-new]

Post by admin »

Actually the note is about implementing business logic using either of the syntaxes. It is like saying you can do everything using statement with a while statement that you can with a for statement. Of course, the code will be slightly different with both.

The point is about not mixing both the syntaxes in the same code base as they may cause confusion.
If you like our products and services, please help us by posting your review here.


Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests