- public class JavaTest {
- public void Method()
- {
- System.out.println("Method");
- }
- {
- System.out.println(" Instance Block");
- }
- public void JavaTest()
- {
- System.out.println("Constructor ");
- }
- static {
- System.out.println("static block");
- }
- public static void main(String[] args) {
- JavaTest c = new JavaTest();
- c.JavaTest();
- c.Method();
- }
- }
- a) Instance block, method, static block, and constructor
- b) Method, constructor, instance block, and static block
- c) Static block, method, instance block, and constructor
- d) Static block, instance block, constructor, and method
No comments:
Post a Comment