We all love the mechanism of python, where we don’t have to bother about data types of the variables (don’t we!)
Interestingly we have one class in Java too, which is pretty similar !
Yes, you guessed it right! It’s java.lang.Object
java.lang.Character java.lang.Integer java.lang.String java.lang.Double java.lang.Boolean
Such a behaviour can be attributed to the fact that java.lang.Object is super class to all other classes. Hence, a reference variable of type Object can be practically used to refer objects of any class. So, we could also assign y = new InputStreamReader(System.in) in the above code!
This article is contributed by Ashutosh Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Flexible Array Members in a structure in C
- Aashish Barnwal - Geek on the top | Make a habit of writing clean, readable, flexible and robust code
- Is there any equivalent to typedef of C/C++ in Java ?
- LinkedHashMap and LinkedHashSet in Java
- What is the difference between field, variable, attribute, and property in Java
- Difference between ArrayList and HashSet in Java
- Difference Between LinkedList and LinkedHashSet in Java
- Get first and last elements from ArrayList in Java
- Try, catch, throw and throws in Java
- Count number of a class objects created in Java
- Differences between wait() and join() methods in Java
- How do Dynamic arrays work?
- Get name of current method being executed in Java
- Maximum number of Unique integers in Sub-Array of given size