O'Reilly logo

Special Edition Using Java 2 Standard Edition by Geoff Friesen, Chuck Cavaness, Brian Keeton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Type Conversions

A critical part of understanding data types in a programming language is knowing how expressions that contain different types are evaluated. For example, how does the language handle situations where a float is assigned to a double or a byte is added to an int? Java is a strongly typed language, so issues like this are resolved at compile time. Extensive type checking is performed (to help detect programmer errors) and strict restrictions are imposed on which values can be converted from one type to another.

There are really two different kinds of conversions:

  • Implicit conversions occur any time a value is of a different type than that required in an expression and the compiler can safely convert it to what is required. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required