KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
public class FinallyTest { static int i=0; public static void main(String a[]){ while(true){ try{ i=i+1; return; }finally{ i=i+1; break; } } System.out.println(i); } } In the above code output is '2'. What I was expecting was that nothing should be printed. What exactly does 'break' do here? Please explain. Thanks
Tags (comma-separated)
Save Edits
Cancel