inline class to anonymous: replace varargs with array creation

This commit is contained in:
anna
2010-02-27 20:19:21 +03:00
parent 85fdbe5309
commit 50de08af4a
4 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
class A {
private Object b = new MyException("w");
private class <caret>MyException implements Runnable {
public MyException(String...msg){
this(new Throwable(), msg[0]);
}
public MyException(Throwable t, String msg)
{
System.out.println(msg);
}
public void run(){}
}
}

View File

@@ -0,0 +1,10 @@
class A {
private Object b = new Runnable() {
{
System.out.println(new String[]{"w"}[0]);
}
public void run(){}
};
}