How can we use primitive data types as objects in Java?

An object of Double is created. An object of Boolean is created. In the above example, we have created variables of primitive types ( int , double , and boolean ). Here, we have used the valueOf() method of the Wrapper class ( Integer , Double , and Boolean ) to convert the primitive types to the objects .

Sizin İçin Seçtik  What is the difference between primitive and object type?

Leave a Reply

Your email address will not be published. Required fields are marked *