- #1
Mr Davis 97
- 1,462
- 44
I am writing code in both Java and Python, and am a little confused about one thing: casting. In Python, we cast data types by using int(), str(), float(), etc. These are functions which convert one data type to its representation as another data type. However, in Java, it doesn't work like this. If I use (int) "25", the 25 is not converted to an integer 25. Basically, my question is, why doesn't this work in Java, and how do I cast in the same way as shown in Python?