0
Mythread t1 = New Mythread (obj); this code what tells us explain?
2 ответов
0
If I'm horribly mistaken then someone can correct me. But I'm pretty sure that creates an Object called "Mythread" with a variable (or reference?) called "t1".
0
Ares is correct. Instantiating an object of any type can be done with
Type variableName = new Type();
if a no argument constructor is present. If a constructor has more arguments (one in your example) then you insert them accordingly.
It looks like you might be trying to create a new thread? If Mythread is a class that extends Thread (a built in Java class) then you can make a new concurrent thread by calling start on t1 (t1.start()).
In this case obj would be something that implements the interface 'Runnable'