Skip to content

Tag: wrapper

Java wrapper classes – change value of parameters

I keep seeing the following when I look up why use wrapper classes: Objects are needed if we wish to modify the arguments passed into a method (because primitive types are passed by value). if we set the parameter to the return value we can modify the primitive everything in java is passed by value What does the statement actually

Simple way to get wrapper class type in Java

I have a piece of code where I need to pass the class of a field in a method. Because of the mechanics of my code I can only handle reference objects and not primitives. I want an easy way of determining if a Field’s type is primitive and swap it with the appropriate wrapper class. So in code what