Last active
November 4, 2019 07:25
-
-
Save libliboom/d64972ed0dcb8cb080fb93b271882f17 to your computer and use it in GitHub Desktop.
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
class ExchangeRate { | |
private int CountryCode; | |
public void b() { | |
Info info = new Info(); | |
int d = info.day; | |
int m = info.month; | |
int y = info.year; | |
} | |
public class Info { | |
public int day; | |
/*package*/ int month; | |
private int year; | |
public Info() {} | |
public void setDay(int day) { | |
this.day = day; | |
} | |
public void a() { | |
int code = CountryCode; | |
} | |
} | |
} | |
public class InnerClassEx { | |
public static void main(String[] args) { | |
// possible | |
ExchangeRateEx.Info info = new ExchangeRateEx().new Info(); | |
info.setDay(0); | |
System.out.println(info.day); | |
// java.lang.NoSuchMethodException: map.ExchangeRate$Info.<init>() | |
try { | |
ExchangeRateEx.Info.class.getConstructor(new Class[0]); | |
} catch (NoSuchMethodException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment