When to use Integer.parseint

Why is Integer.parseint () used when we have type casting?

Perhaps another way to ask this question would be:

When should Integer.parseint () be used for type casting?

+4
source share
1 answer

The casting type is used to assign an object of one type to another without changing or analyzing the contents of the object. Although the parseInt method parses the String values ​​and converts it to an integer value, that is, it converts the String value to integer.

Type listing has nothing to do with the contents of an object. It is used only to assign a reference type of one type to another. For example: Object obj = new String(""); String string = (String) obj; Object obj = new String(""); String string = (String) obj;

+2
source

All Articles