Page 1 of 1
About Question enthuware.ocajp.i.v7.-2-.-1138 :
Posted: Thu Apr 18, 2019 5:16 am
by Hamza1
creating a new object from a class means to invoke his methods ?? I am confused
Re: About Question enthuware.ocajp.i.v7.2.1138 :
Posted: Thu Apr 18, 2019 5:28 am
by Hamza1
admin wrote: ↑Sun Mar 23, 2014 8:27 pm
The line of code is System.out.println( new SubClass() ); so first a new SubClass object will be created and that object will be passed to the println method. The method will then cause the toString method on that object to be invoked.
why?
Re: About Question enthuware.ocajp.i.v7.2.1138 :
Posted: Thu Apr 18, 2019 5:45 am
by Hamza1
Hamza1 wrote: ↑Thu Apr 18, 2019 5:28 am
admin wrote: ↑Sun Mar 23, 2014 8:27 pm
The line of code is System.out.println( new SubClass() ); so first a new SubClass object will be created and that object will be passed to the println method. The method will then cause the toString method on that object to be invoked.
why?
it is clear now for me ,, thanks hhhhhhhh