CS 151 Lecture Notes - Lecture 6: Standard Streams, String Literal

78 views2 pages

Document Summary

A conversion between one primitive type and another falls into one of two categories: widening conversions and narrowing conversions. Widening conversions: translate data into another data type that uses equal or greater space, safest conversion because it does not lose info, can lose precision (because of rounding least significant digits) Narrowing conversions: more likely to lose info, translates data into data type that uses less space, should be avoided. Assignment conversion: occurs when a value of one type is assigned to a variable of another type during which the value is converted to the new type. Promotion: occurs automatically when certain operators need to modify their operands in order to perform the operation. Similar conversion is taking place when a number is concatenated with a string. Casting: most general form of conversion in java. A cast is a java operator that is specified by a type name in parentheses. Placed in front of the value to be converted.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents