Lesson+02+-+Variable+Types+(String,+int,+double)

Names: Jose, Maybeth, Roxana
 * There are //__three__// types of variables:**

1. **String** - stores text Ex: String s = "Hello World";

2. **int** - stores whole numbers Ex: int x = 25;

3. **double** - stores fractions/decimals Ex: double d = -137.8036;

double x = 1.6;
 * //When saying://**


 * we are..**

1) We are declaring x to be of type double 2) We are initializing x to the value of 1.6

//**Write double d = -137.8036; as 2 lines of code**// double d; //declaring// //d = -137.8036;// initializing

//**Scientific Notation**// double x = 1.732E2 is the same as 1.732 x 10 to the 2nd power OR 173.2 double y = 1.732E3 is the same as 1.732 x 10 to the 3rd power OR 1732.0 All scientific notation will result in decimal answers, so need that .0!!

//**Legal or Illegal?**// int x = 4.0; //illegal -- A double can't fit into an int. Even though .0, Java doesn't like to lose data.// //double y = 4;// legal -- OK for an int to go into a double. y will be 4.0.

//**Rules for Variable Names**//
 * must begin with a letter or an underscore _
 * only punctuation allowable is underscore _
 * can't be a keyword aka reserved word (see Appendix A)

//**Conventions for Variable Name**// Variable names with multiple words should be combined either myName or my_name