K
K
Kirillh2016-05-14 19:21:43
Java
Kirillh, 2016-05-14 19:21:43

What is this way of initializing an object in Java called?

public class User implements Runnable {
...
}

User user = new User();

        (new Thread(frontend)).start();

What is the name of this way of initializing an object without a reference (new Thread(frontend)) ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-05-14
@Kirillh

Способ инициализации никак не называется. Получается просто анонимный объект. У вас на него нет явной ссылки. Получить её можно будет только изнутри вашего Runnable с помощью Thread.currentThread().

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question