interesting# Java - 爪哇娇娃
c*t
1 楼
It is interesting that Java allows $ in the class name and thus you
can do the following:
In T.java
public class T
{
static class O
{
public static void run (String msg) { }
}
public static void main (String[] args)
{
T.O.run ("over");
}
}
Then in T$O.java
class T$O
{
public static void run (String msg) { System.out.println (msg); }
}
Compile T.java first, then T$O.java.
They probably allowed it so that some
can do the following:
In T.java
public class T
{
static class O
{
public static void run (String msg) { }
}
public static void main (String[] args)
{
T.O.run ("over");
}
}
Then in T$O.java
class T$O
{
public static void run (String msg) { System.out.println (msg); }
}
Compile T.java first, then T$O.java.
They probably allowed it so that some