0

What will be Output of the following codes:--

class A{ private int i; A(int i){ this.i=i; } } class B{ A i= new A(10); System.out.print(i); }

4th Aug 2020, 8:17 AM
FzTechnology ken
FzTechnology ken - avatar
4 Answers
0
I think this will be the hexadecimal number, because you are printing an address, if you want the value you need getter function
4th Aug 2020, 8:23 AM
PandašŸ¼šŸ¼šŸ¼
PandašŸ¼šŸ¼šŸ¼ - avatar
0
In addition to.. Its error. You have to includes all definition statements in methods in java. You should have main method.. then you get i object address.
4th Aug 2020, 2:48 PM
Jayakrishna šŸ‡®šŸ‡³
0
Jayakrishna you're right
11th Aug 2020, 4:47 PM
FzTechnology ken
FzTechnology ken - avatar
0
Yahaj
11th Feb 2024, 6:59 AM
Yogita Prajapati
Yogita Prajapati - avatar