What will happen when the following code is compiled and executed?

00: package test;
01: public class Test {
02:     public static void main(String [] args) {
03:          Test test = new Test();
04:          System.out.println(test.toString());
05:     }
06: }
Explanation
All objects in Java are inherited from the Object class. Since a Test class does not override a toString() method, it will use its Object class implementation, which returns a string representation of the object as follows: class name (with a full package name) + @ symbol + hexadecimal unsigned value of object's hash code

Следи за CodeGalaxy

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

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