PLEASE SUBSCRIBE!!!
The previous videos were a review of String methods:
Lesson 5: • Java Programming: Lesson 5 - String M... (length, equals, equalsIgnoreCase, toUpperCase, toLowerCase, concat)
Lesson 6: • Java Programming: Lesson 6 - More Str... (substring, startsWith, endsWith, replaceAll, replaceFirst, indexOf)
Lesson 3 introduced int and double variables and talked about conversions between them. Here, we expand on our discussion to discuss casting with Strings. Not only does Java prefer doubles over ints, but it also prefers Strings over doubles. We deal with methods for converting among the three data types, as well as what results might be expected.
int to double: implicit, or use (double)
double to int: explicit (int)
int to String: implicit, or use Integer.toString(x)
String to int, explicit Integer.parseInt(s)
double to String: implicit, or use Double.toString(x)
String to double, explicit Double.parseDouble(s)
1:40 Review of Casting between Ints and Doubles
4:30 NEW: Implicit Casting of an Int to a String
6:15 NEW: Implicit Casting of a Double to a String
7:28 NEW: Explicit Cast of String to Int with Integer.parseInt( s )
11:16 NEW: Integer.toString( x ) and Double.toString( x )
12:39 NEW: Explicit Cast of String to Double with Double.parseDouble( s )
A somewhat equivalent lesson regarding data type conversions between ints, doubles (floats), and Strings in PYTHON is available here: • Python Programming: Lesson 4 - Variab...
Ready for boolean expressions (true/false)? Proceed to lesson 8 here: • Java Programming: Lesson 8 - Boolean ...
Thanks for watching, and PLEASE SUBSCRIBE!!!
Смотрите видео Java Programming: Lesson 7 - Casting ints, doubles, and Strings онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал youmils03 10 Август 2021. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 49 раз и оно понравилось 1 посетителям.