Differentiate switch and if statements in java.
Explain nested switch with example.
how can we use break as a form of GOTO statements
Atif Azmi 0 Newbie Poster
Recommended Answers
Jump to Postint i=0; switch (i) { case 1: System.out.println("Value 1"); break; case 2: System.out.println("Value 2"); break; }
The code checks 'i''s value. When it finds a case that has that value, it executes what is under it.
So the above code will print: "Value 1". Then break will …
All 4 Replies
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
peter_budo commented: Been fooled by silly request, but provide great work +10
masijade 1,351 Industrious Poster Team Colleague Featured Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
stultuske 1,116 Posting Maven Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.