Data types in java

16,245 views

Published on

Java data types

6 Comments
8 Likes
Statistics
Notes
No Downloads
Views
Total views
16,245
On SlideShare
0
From Embeds
0
Number of Embeds
1,249
Actions
Shares
0
Downloads
0
Comments
6
Likes
8
Embeds 0
No embeds

No notes for slide

Data types in java

  1. 1.  A data type in a programming language is a set of data with values having predefined characteristics
  2. 2.  Each individual character in java program Tokens Java
  3. 3.  Literals •Punctuators Identifiers •Separators Assignments •Operators
  4. 4. TOKENSA = B + 10 ;I P A ID O U S D LE S E P N IN I N E C TT G T R T EI N I A U M F RF T A E I AI O T N E LE R O T RR R
  5. 5.  These are constants in java program The values are fixed
  6. 6. STRING LITERALS REAL LITERALS CHARACTERINTEGER LITERALS Literals LITERALS BOOLEAN NULL LITERALS LITERALS
  7. 7.  The number that are represented without decimal point Whole numbers having positive or negative values Ex: 16,986,-99,-765
  8. 8.  Floating point constants Numbers with decimal points Ex: 89.7, 0.0098, -3.2267,1.0E-03
  9. 9.  Constants which are alphanumeric in character Alphabets (upper and lower) Digits Special characters Eg: „B‟, ‟f‟ , ‟4‟ , ‟*‟ Character represents a single digit enclosed within single quotes
  10. 10.  Set of alphanumeric characters Group of characters enclosed within double quotes Eg: “Computer” „ “year 2012”
  11. 11.  They are special literals They represent true or false and is applied in logical situation There will be no quotes
  12. 12.  It is represented as „/0‟ String terminator Marks the end of the string
  13. 13.  Punctuation signs used as special characters Ex: ? ; . ; - Statement terminator . - scope of a function Any line continued after semicolon is treated as next line
  14. 14.  Special characters in java which are used to separate the variables or the characters () [] {} () – to enclose arithmetic or relational expression [] – to enclose subscript or cell number of a dimensional array {} – to enclose a group of statements
  15. 15.  Non-graphic characters They cannot be typed directly from the keyboard Begins with a followed by one of two characters r - horizontal tab v- vertical tab b - backspace
  16. 16.  Symbols or tokens Performs arithmetic or logical operations Three types Arithmetic Operator( +, - , *, /) Relational Operator(< ,> , <=, >=, ==, <>) Logical operator ( &&, ||,!)
  17. 17. INTEGERS NUMERIC FLOATING PRIMITIVE NUMBERS NON NUMERIC CHARACTE RSDATA TYPE CLASSES BOOLEA N NON- ARRAYS PRIMITIVE STRING INTERFACE
  18. 18.  Independent on any other type They are Basic data types EG: byte,int,long,float, double
  19. 19.  Derived data types Directly or indirectly dependent on primitive data type They store data data with reference to the address of locations They are also called REFERENCE DATA EG: arrays,classes,interface etc
  20. 20. •Direct assignment static of a variable with defined constant •Variables getdynamic initialized during run time
  21. 21.  May have any number of characters Contain alphabets, digits and underscore Underscore applied between the characters to increase the length of variable name Name should be meaningful
  22. 22. Pure Mixed int a,b,c; X=a+c*12; Expression which Expression includes containing different type of variablessame type of or values to data items yield a result
  23. 23. ImplicitExplicit
  24. 24.  Data tye gets converted automatically into its higher type without intervention of the user
  25. 25.  When data type gets converted to another type after user intervention int a,b; float x=(float) a+b;

×