Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write A Java Program To Explain the Consept Of Initializer And Class Initializer
- class Ex12 // Ex12 is FileName
- {
- int speed;
- //#Third Priority
- Ex12()
- {
- System.out.println("Constructor is invoked");
- }
- //#Second Priority
- //Initializer Call Every Time After Class
- //Initializer no Need to name
- {
- System.out.println("Instance Initializer Block invoked");
- }
- //#First Priority
- //Class Call Only One Time
- static
- {
- System.out.println("Class Initializer");
- }
- public static void main(String args[])
- {
- Ex12 obj = new Ex12();
- Ex12 obj2 = new Ex12();
- }
- }
Add Comment
Please, Sign In to add comment