Self-paced course

Java Ferienkurs 2025

Offered by openHPI Teaching Team

This video belongs to the openHPI course Java Ferienkurs 2025. Do you want to see more?

4.2 Type Casting

An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.

About this video


Folie 8 (Parsing):

Typo: Interger -> Integer

Folie 5:

Bei der Rechnung mit Fließkomma- und Gleitkommazahlen wird genau dann automatisch ein Type Casting ausgeführt, wenn in die Rechnung eine Fließkommazahl einfließt. Das Casting findet nicht von Anfang an statt, sondern erst sobald es benötigt wird. So ist (6/7)*8.0 immer noch 0.0, weil zuerst die Klammer ausgewertet wird (also eine Integerdivision mit dem Ergebnis 0 stattfindet, dieses dann zu 0.0 gecastet wird und anschließend mit 8.0 mulitipliziert wird (was immer noch 0.0 ergibt).