Create your account

Already have an account? Login here

Note: By joining, you will receive periodic emails from Coursetro. You can unsubscribe from these emails.

Create account

26. Switch Statement Example

Getting Started with Java

Woah, wait a second..

This is a 100% free course, but we need you to first join or login to watch this video.

Alright, join or login here.

This video shows you an example of switch statement in Java. The switch statement takes a variable and compares its value with the all the cases that you write inside the switch statement. Each case can optionally add a break statement at the end. If you don’t add the break statement, the code starts executing at the point where the case matches the value of the variable and ends when it finds the first break statement regardless of how many cases were present in between. The default case is optional and is triggered when the value of the variable does not match with any of the listed cases.

Course Cirriculum