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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Swap the first and last character of a string in Java
- Cryptographic Hash Function in Java
- How to create customized Buttons in Android with different shapes and colors
- How to add Toggle Button in an Android Application
- Logcat window in Android Studio
- BottomNavigationView in Android
- Spring Boot | How to consume JSON messages using Apache Kafka
- MultiThreading in Android with Examples
- ShimmerLayout in Android with Examples
- How to create a nested RecyclerView in Android
- How to add Lottie Animation in an Android app
- Difference between AWT and Swing in Java
- Python vs Java - Who Will Win the Battle in 2020?
- Java Collectors