SWITCH CASE AND BREAK CASE

 1.use of switch case or switch statement:-

Java has a built-in multiway decision statement called a switch statement. Switch-case is used when we have to choose between multiple alternatives for a given variable


2. break statement use:-

the break statements are necessary because without them, the case statement fall through.

it
is important to notice the use of break statement after each case in the switch statement. Each break statement terminates the enclosing switch statement, and the flow of control continues with the first statements following the switch block.

स्विच केस या स्विच स्टेटमेंट का उपयोग :-

जावा में एक अंतर्निहित मल्टीवे डिसीजन स्टेटमेंट है जिसे स्विच स्टेटमेंट कहा जाता है। स्विच-केस का उपयोग तब किया जाता है जब हमें किसी दिए गए चर के लिए कई विकल्पों में से किसी एक को चुनना होता है


ब्रेक स्टेटमेंट का उपयोग:-

ब्रेक स्टेटमेंट आवश्यक हैं क्योंकि उनके बिना केस स्टेटमेंट विफल हो जाता है।

स्विच स्टेटमेंट में प्रत्येक मामले के बाद ब्रेक स्टेटमेंट के उपयोग पर ध्यान देना महत्वपूर्ण है। प्रत्येक ब्रेक स्टेटमेंट एनक्लोजिंग स्विच स्टेटमेंट को समाप्त कर देता है, और नियंत्रण का प्रवाह पहले स्टेटमेंट के साथ जारी रहता है।


Rana pratap prasad

Comments