How can I represent a value via an object(A custom value)
Hello, I would like to ask how to represent a value using object (I am not talking about referring the the object itself, but represent a custom value.)
This is one of the class that I found having a custom value
It is wrapper class. When I try to print a wrapper class object (Integer
for example),it prints out the value that I stored in it.
package Testing;
public class test {
static Integer one = 1;
public static void main(String[] args) {
System.out.println(one);
}
}
So, I create an Integer
object, and when I print it, it prints the value that I stored in it.
So,
I wanted to understand how it work. Sorry if it is a build in feature (that can't be coded in regular java)
Thank you :)