80 likes | 212 Views
Data Types, Data Structures and Constructs in Java. Drew Bacha Chapter 2, 2.1.1-3. Primitives. Beyond Primitives. The difference between a primitive and a class is that a class, String, starts with a capital letter. length() is method that returns the current length of the string name.
E N D
Data Types, Data Structures and Constructs in Java Drew Bacha Chapter 2, 2.1.1-3
Beyond Primitives • The difference between a primitive and a class is that a class, String, starts with a capital letter. • length() is method that returns the current length of the string name.
Casting, Sequence, Nesting • Casting means converting from one data type to another. Placing the primitive type in front of the right hand side of an assignment. • Ex. int k = 450; • double x = k; // k gets converted to a double • A sequence of instructions is where statements or actions in an algorithm simply flow from one to the next. • Nesting occurs when one control variable(if and if else are control structures) is placed inside another.