+ 3
What if we put default case first while testing conditions in switch case,without having break in any of the consecutive cases?
How the compiler checks the conditions in switch case...how does the flow of compiler affects the output..??
2 Antworten
+ 1
it will flow to default if doesnt have break ,u can check out this code
https://code.sololearn.com/cqF5Hl1HlEJ2/?ref=app
0
It will take time to compile untill that last line reaches and shows output as per matched condn but not preferred bcz of time wastage