Given a sample code:
1 public class Test2 {
2 public static void main(String[] args) {
3 System.out.println("Hello");
4 break;
5 System.out.println("Hi");
}}
What will be result when compiled and run?
(A) Hello
(B) Hello Hi
(C) Runtime exception.
(D) Compilation error at line no-4.
(D)
break cannot be used outside of a loop or a switch