Passing a new object to a constructor please clarifiy the concept for me please.
I'm hoping a kind soul would help clear up a situation for me?
I am following a course at the moment and I'm confused by this code,
Thread newThread = new Thread(new ThreadClassName, "thread one");
the aspect I'm struggle with is the declaration of ...(new ThreadClassName, ...
I understand the constructor needs two arguments for this overloaded constructor a Runnable target and a String name.
I have been use to the follow way to constructor a thread
ImplementedClassWithARunnableInterface runClass = new ImplementedClassWithARunnableInterface();
Thread myThread = new Thread(ImplementedClassWithARunnableInterface);
Why is it possible just to say new then the class name instead of defining a data type and name but just passing a new statement to the constructor.
Please forgive me if I can't articulate the problem in a clearer and more defined way but this is due to me not understanding the circumstance.