What will be printed out after the following code execution?

public class Test {

    private String name;

    Test(String name) {
        this.name =  name;

    public void test(Test test) {        
        test = new Test("three");

    public String toString() {
        return name;

    public static void main(String[] args) {
        Test t1 = new Test("one");
        Test t2 = new Test("two");
Object references are passed to the method by value and they cannot be changed by being reassigned to new objects.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Зарегистрируйся сейчас
или Подпишись на будущие тесты