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
Зареєструйся Зараз
або Підпишись на майбутні тести