Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Basic Data Storage

375 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Basic Data Storage

  1. 1. Basic Data Storage
  2. 2. ConstantsData that never changes
  3. 3. Constants true 89 4.6 k "Sunnyvale"
  4. 4. VariablesA storage place for data that you can refer to by name and may be changeable
  5. 5. Initializing VariablesSpecify whatkind of data to store type name = value; Set it to an initial Give it an identifier value
  6. 6. Primitive Data Typesboolean shortbyte intchar longString float double
  7. 7. Default Valuesboolean false byte 0 char u0000String null short 0 int 0 long 0L float 0.0fdouble 0.0d
  8. 8. Possible Valuesboolean false, true byte -128 to 127 char u0000 to uffffString "" short -32,768 to 32,767 int -2,147,483,648 to 2,147,483,647 long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 float 32-bit floating pointdouble 64-bit floating point
  9. 9. Variable Namesa-z, A-Z, 0-9, _, $begin with a-z, A-Z, _, $usually begin with a-z$ rarely usedcase sensitive: a ≠ Acamel case
  10. 10. Variable Names valid preferred $firstName firstName _lastName lastName Age age zip_code zipCode CITY city rel2Per relationshipToPersonaddressline2 addressLine2 c count
  11. 11. Samples boolean flag = true; byte b = 0; char character = a; String firstName = "Marisa"; short age = 13; int revolutionsPerHour = 65000;long grainsOfSand = 14789409243948903; float length = 21.5; double pi = 3.1415926535897;

×