What is the output?
package com.jsl.core.basic; public class Welcome{ static int a=printMessage(); static{ System.out.println("Static block :" +a); } public static void main(String miani[]) { System.out.println("Main Method"); } private static int printMessage() { System.out.println("The print message method :"+a); return 100; } }
What is output?
package com.jsl.core.basic; public class Welcome{ static{ System.out.println("Static block 2" ); } public static void main(String miani[]) { System.out.println("Main Method"); } static{ System.out.println("Static block 1"); } }
What happens when you compile and execute the program ?
package com.jsl.core.basic; public class Welcome{ int a=100; static{ a=a++ + a++; } public static void main(String miani[]) { System.out.println("Main Method "+a++); } static{ System.out.println("Static block "+a); } }
What happens when you compile and execute the program?
package com.jsl.core.basic; public class Welcome{ int a=100; static{ int a; a=a++ + a++; System.out.println("The value of a is : "+a); } public static void main(String miani[]) { System.out.println("Main Method "); } static{ System.out.println("Static block "); } }
What happens when you compile and execute the program?
package com.jsl.core.basic; public class Welcome{ int a=100; static{ int a; a=a++ + a++; System.out.println("The value of a is : "+a); } public static void main(String miani[]) { System.out.println("Main Method "); } static{ System.out.println("Static block "); } }
No comments:
Post a Comment