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 firstname.lastname@example.org. 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
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Automated Time-Based Reload Response in Java Web Servlet
- How to Write Data into Excel Sheet using Java?
- Java Program to Convert Date to String
- Java Program to Find Sum of N Numbers Using Recursion
- Java Program to Print the Elements of an Array Present on Odd Position
- Java Program to Print the Smallest Element in an Array
- Java Program to Define Ordinal() Method Using Enum Concept
- Implementing Associate Array in Java
- Java Program to Convert Long to String
- Java Program to Print All the Repeated Numbers with Frequency in an Array
- Java Program to Get Elements of a LinkedList
- Java Program to Check if Two of Three Boolean Variables are True
- Java Program to Convert Octal to Decimal
- Java Program to Reverse a Number