I have a collection (or list or array list) in which I want to put both String values and double values. I decided to make it a collection of objects and using overloading o
Everything in Java is an Object
/object (except primitive types). You store strings and integers as objects, and then as you call the prove
method they are still referred to as objects. You should have a look at the instanceof
keyword. Check this link
void prove(Object o){
if (o instanceof String)
System.out.println("String");
....
}