I can do this:
new Object(){
public void hi(){}
}.hi();
how do i (or can i) do this:
IWouldRatherStayAnonymous t = new IWouldRatherStayAnonymous extends Thread(){
public void NoNoYouCantCallMe(String s){}
};
t.NoNoYouCantCallMe("some useful data that i will need later, but don't want to save this anonymous class");
and if i can't syntactically do this, can anyone explain the logic/implementation design that of why this would never work?
==========================================
Edit: clarifications - I would like to create an anonymous class without saving it, and then instantiate an instance of that anonymous class. I only need 1 reference, since i don't plan on using this reference often (nor do i want anything else even in the same outer class to use it). However, I would like simply like to pass some data to this anonymous class only once (ideally the constructor, but you will notice that you can't actually override the constructor in Thread()).
It's really not a HUGE deal, I was just curious if this was doable, but it seems from some of the answers that it is feasible, but just not very pretty.