1. Write the output of these code block without running (5) class StaticTest { static int x = 1; int y; StaticTest() {
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
1. Write the output of these code block without running (5) class StaticTest { static int x = 1; int y; StaticTest() {
(5) class StaticTest { static int x = 1; int y; StaticTest() { y++; } public static void main(String args[]) { StaticTest st = new StaticTest (); System.out.println("x=" + x); System.out.println("st. y=" + st. y); st= new Static Test(); System.out.println("x=" + x); System.out.println("st. y=" + st. y); } static { x++; }