2. What are data types? Data types in Java Variables Literals Agenda
3. classification identifying one of various types of data They have special features and requirements Perform operations on data They need memory What are data types?
4. 8 primitive data types, all signed (+,-) Irrespective of environment the data types have same size Data types in Java
5. Variables/Fields stores values with specific data type Instance variables (object fields) Class variables (static fields) Local variables (method fields) Parameters (arguments passed to a method) int age; long creditCardNumber; Terminate with semi-colon or separate with comma int age, long creditCardNumber; Variables
6. Variable names are case-sensitive Unlimited length with letters and digits Begin with letter, ‘$’,’_’ Don’t use ‘$’ or ‘_’ Whitespace not allowed Subsequent characters may be letters, digits, dollar signs, or underscore characters Use meaningful names Use Camelian Notation intcreditCardNumber; Variable naming
7. Fixed values assigned to variables without computation int age = 32; long creditCardNumber = 135353553566; Literals
8. Write a simple Java program and declare 3 variables – your age (integer), your credit card number(long), and your bank balance(double) Assign literal values to these fields Print the 3 values in console Exercise