-
-
Save NeQuissimus/e2930ccd8cb112a2292efba7d4667af6 to your computer and use it in GitHub Desktop.
What does this program output?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What does this program output? | |
class S { | |
static final int I = 7; | |
static { | |
System.out.println("S"); | |
} | |
} | |
class T { | |
static final Object S = null; | |
static { | |
System.out.println("T"); | |
} | |
} | |
class U { | |
static final Object S = "s"; | |
static { | |
System.out.println("U"); | |
} | |
} | |
class V { | |
static final String S = "s"; | |
static { | |
System.out.println("V"); | |
} | |
} | |
class W { | |
static final String S = new String("s"); | |
static { | |
System.out.println("W"); | |
} | |
} | |
class X { | |
static final int I = 7; | |
static { | |
System.out.println("X"); | |
} | |
} | |
class Y { | |
static final int I; | |
static { | |
I = 8; | |
System.out.println("Y"); | |
} | |
} | |
class Z { | |
static final Integer I = new Integer(7); | |
static { | |
System.out.println("Z"); | |
} | |
} | |
class Stnts { | |
public static void main(String[] args) { | |
int s = new S().I; | |
Object t = T.S; | |
Object u = U.S; | |
String v = V.S; | |
String w = W.S; | |
int x = X.I; | |
int y = Y.I; | |
Integer z = Z.I; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment