What's new in Java Switch | Switch Statement and Expression
Вставка
- Опубліковано 18 лип 2022
- Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
More Learning :
Java - bit.ly/3xleOA2
Python :- bit.ly/3H0DYHx
Django :- bit.ly/3awMaD8
Spring Boot :- bit.ly/3aucCgB
Spring Framework :- bit.ly/3GRfxwe
Servlet & JSP :- bit.ly/3mh5CGz
Hibernate Tutorial :- bit.ly/3NWAKah
Rest API | Web Service Tutorial :- bit.ly/38RJCiy
Git :- bit.ly/3NUHB3V
JavaScript :- bit.ly/3mkcFys
Kotlin :- bit.ly/3GR2DOG - Наука та технологія
Its good that they have finally updated the switch statement syntax. Not that I had any issue with the previous syntax with break statement but now the arrow syntax definitely makes the code more readable and easier to write. And I just love the fact that they have added the return feature in switch, it makes a lot of things easier😁
as an old school learner, the old switch syntax was cooler, no offence to the new learners.
That's the benefit of following Navin sir's videos!
Thank you sir for sharing :)
Love the new switch syntax! Didn't have an issue with the old way as it is more expressive but this new way has certainly grown on me.
The way you explain is excellent sir. Iam very grateful to you sir.I hope one day I can explain like this to others.
I like this syntax... Thanks for keep updating us.. i hope you will give such update in future also.
Love and respect from 🇨🇩🇨🇩🇨🇩 your channel has helped me a lot NAVIN.
I like the switch updates. Thanks man 👍
i liked old switch statement
I liked it and felt more relevant than old syntax
Looks readable & amazing!!
Great features. Very informative video. 🔥
Really good future and thank you for explaining us
Thank you for your teaching
very much liked this new switch case functions
Yes, I enjoyed your video!
Amazing the new method 👍
Thank you so much sir ❣️
It is actually great...
its good for understanding sir
Thanks
thank u very much actually it's makes a sense
Awesome
Thank you I like the new update it helps me reduce the amount of text typed when coding.
So Amazing teaching style sir thank you🎉🎉🎉🎉🎉
Thank you sir
Nice tutorial
00:03 Updated version of switch statement in Java
01:32 Using switch statements in Java
02:55 Application to set alarms based on the day
04:19 Waking up schedule
05:42 Updated version of system.twintellin has new features.
07:04 Assigning a value to a variable instead of printing it directly
08:27 Using switch as an expression
09:51 Java 12 introduces the use of 'yield' instead of 'break' in switch statements
Thank you
I like the arrow operator, without the "break" statement. I see lots of similarities between C and Java, I am C embedded designer. I am planning to use Java for embedded (small computer forms - Microcontroller based) web servers. In your openion, what is a good Java flavor, library, extension and whatever that best fits for embedded designers? Is there a Java package that is dedicated mainly for embedded (hardware and software) designers? What is a good website that explores those possibilities? I am familiar with Eclipse, Andorid Studio, and many dedicated IDEs that belong to silicon manufacturers and their likes among IDEs - your help is greatly appreciated.
THAT'S GREAT
I loved the switch new syntax.
Great
I like it.
IT IS very good feature I like this new feature
its good
For Saturday and Sunday you set an alarm clock earlier than for weekday. Java developer as is.
nice
Commenting for the algo. Quality content.
I actually like them both equally as being a beginner i have nothing to do with code optimisation while saving lines
What if for each case we want to return different data types then how we can assign switch case to reference variable (result)
is this update a good way? In case I need to continue the block. what can I do in the update switch statement? I think this update is easy to write a code but how do we continue the block?
I feel we don't need to put break at the end of case. Next case starting means end of the previous. Hope they remove that break without changing the syntax
do we have to write it in a block with there are multiple statements associated with a case
good
I don't know but have gut feeling soon java will be standing next to python and R for ML or may be for block chain
When we need to write more than one line in cases,how can we use arrows sir.
Sir please make videos on frontend development using python programming .please sir
break seems like good for kick start/
finally, now they are adopting kotlin syntax.
It's definitely welcome feature to not have to declare a break statement on all my switch cases.
after arrow operator , can we use compoud statement?
🙌
Is there any relationship with Lemda -> or switch ->
i think older version is good according to coding lines and syntax
java --version
java 12.0.2 2019-07-16, I see java 12 in my system, but this syntax not working, getting an error.
♥️
Where you got updated these things sir
Where can I see new updates like this?
What if we want to have more than one statement in updated switch block..
Can we write multiple line statements in cases as we do in lambda expression using open close braces?
yes but use yield keyword
It’s similar to cpp(Most of the syntax)
What if we have to execute Multiple statements after -> or yeild ?
for that simple use previous concept of switch;
Why it is not working in vs code?
So basically they allow to put lambda expressions in switch case
Sad that pattern Matching, gaurded Patterns and null-safe were not covered
the format case "monday" -> output is not working ..showing like invalid syntax
Sir we cant use switch statement in while loop because the break statement breaks entire looop😔😔
Hi sir, I'm stuck as software test engineer. I need to switch to development please suggest good path. I'm flexible in coding language
why am I getting an error when using multiple cases in single case
public class Main
{
public static void main(String[] args) {
String d="f";
switch(d)
{
case "f", "m":
System.out.println("work");
break;
case "sat":
System.out.println("gym");
}
}
}
ERROR:
Main.java:19: error: : expected
case "f", "m":
^
1 error
i am not facing any issue bro
public class hello{
public static void main(String[] args){
String d="f";
switch(d)
{
case "f", "m":
System.out.println("work");
break;
case "sat":
System.out.println("gym");
}
}
}
Correction: Strings are supported from Java 7
22 seconds of darkness at the end...
Lessons are Good, may you please not blur the board!
Nice feature😅
I never understood the concept of the old switch needing the break. I guess it serves a purpose for some people, but it makes no sense to me.
I just learned you could use multiple conditionals for the same case... I just copied the code 2 times.
Coming from golang its normal but here looks like oracle or Java communities trying hard to catch up with modern language like go.
I'd stick to the old syntax
Java is copying things from python and javascript, finally!! 😂😂😂
Yeah it seems
Similar to kotlin
Shit java is too much every time I think I reach the end of a lesson , some new thing always comes up. I haven't gotten any where as yet to build a project. But any way I'll try.
java is the new kotlin
This video series is unique but language problem 😢 Hindi or English mix rahta
I think it's a good thing but old switch is better than this 😁
I don't even know Java 8 and Java is at v17🤦 after v100 Java will be rebranded to new jabaa language 😁😁
Better create new language for this. It makes java more complicated. This is good for intelligent people. How about the average? Maybe they have no right to become a developer.
Thank you
Thanks sir
Great