Type conversions between classes in an inheritance hierarchy are referred to as "upcasting" and "downcasting" in Java. When working with polymorphism and inheritance, these conversions are frequently required. Let's look at both ideas:
Tag
java basics
All blogs tagged with java basics
3
Articles
11,157
Total Views
Showing 3 of 3 articles
03
Sep
2023
Upcast and Downcast in Java
27
Aug
2023
java.lang.NumberFormatException
A NumberFormatException is produced in Java when you try to convert a string to a numeric type (such as int, double, float, etc.) but the string's format is incompatible with the required format for that numeric type. This is common when using parsing techniques such as Integer.parseInt(), Double.parseDouble(), or Float.parseFloat().
27
Aug
2023
java.lang.ArrayIndexOutOfBoundsException in Java
An ArrayIndexOutOfBoundsException is a runtime exception in Java that happens when you attempt to access an array element with an index that is outside the array's valid range of indices. In other words, you're attempting to access an element in the array at an index that doesn't exist.