For example, I call a method from Integer, like toHexString()
.
Now I need to print it out by the following code.
int i = 123455;
System.out.println(Integer.toHexString(i));
I haven't created a new object named Integer
. Why I can use Integer
, this object, directly?
You can use it like that, because toHexString
is a static
method.
For static
members, you don't need an instance, you can call them directly through the class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With