0
Data Types & Variables<br />DhrubojyotiKayal<br />
What are data types?<br />Data types in Java<br />Variables<br />Literals<br />Agenda<br />
classification identifying one of various types of data<br />They have special features and requirements<br />Perform oper...
8 primitive data types, all signed (+,-)<br />Irrespective of environment the data types have same size<br />Data types in...
Variables/Fields stores values with specific data type<br />Instance variables (object fields)<br />Class variables (stati...
Variable names are case-sensitive<br />Unlimited length with letters and digits<br />Begin with letter, ‘$’,’_’<br />Don’t...
Fixed values assigned to variables without computation<br />int age = 32;<br />long creditCardNumber = 135353553566;<br />...
Write a simple Java program and declare 3 variables – your age (integer), your credit card number(long), and your bank bal...
Q&A<br />
Upcoming SlideShare
Loading in...5
×

04 data types & variables

201

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
201
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "04 data types & variables"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×