What is the correct way to return a new array from a method in Java?
In Java, it's not possible to return an array from a method, because arrays are primitive data types.
Actually, arrays are not primitive types in Java; they are objects, and you can return them from methods.
Can you explain how arrays are handled as objects in Java and how you can return them from methods?