Posted by : Rhyf Ahmad Thursday, May 21, 2015

A variable is a named piece of memory that you use to store information in your Java program — an item of data of some description. Each named piece of memory that you define can only store data of one particular type. If you define a variable to store integers, for example, you can't use it to store a value that is a decimal fraction, such as 0.75.
If you've defined a variable that you use to refer to a Hat object, you can only use it to reference an object of type Hat (or any of its subclasses, as you will see in Chapter 6). Because the type of data that each variable can store is fixed, the compiler can verify that each variable you define in your program is not used in a manner or a context that is inappropriate to its type. If a method in your program is supposed to process integers, the compiler is able to detect when you inadvertently try to use the method with some other kind of data, for example, a string or a numerical value that is not integral. Explicit data values that appear in your program are called literals. Each literal is also of a particular type:  5, for example, is an integer literal of type int. I will go into the characteristics of the various types of literals that you can use as I discuss each variable type.

Contents:

Data and Variables
  1. Naming Your Variables
  2. Variable Names and Unicode
  3. Variables and Types

Integer Data Types
  1. Declaring Integer Variables

Floating-Point Data Types
  1. Floating-Point Literals
  2. Declaring Floating-Point Variables

Fixing the Value of a Variable
Arithmetic Calculations
  1. Integer Calculations
  2. Integer Division and Remainders
  3. The Increment and Decrement Operators
  4. Computation with Shorter Integer Types
  5. Errors in Integer Arithmetic
  6. Floating-Point Calculations
  7. Other Floating-Point Arithmetic Operators
  8. Error Conditions in Floating-Point Arithmetic
  9. Mixed Arithmetic Expressions
  10. Explicit Casting
  11. Automatic Type Conversions in Assignments

The op= Operators
Mathematical Functions and Constants
  1. Importing the Math Class Methods

Storing Characters
  1. Character Escape Sequences
  2. Character Arithmetic

Bitwise Operations
  1. Using the AND and OR Operators
  2. Using the Exclusive OR Operator
  3. Shift Operations
  4. Methods for Bitwise Operations

Variables with a Fixed Set of Integer Values
Boolean Variables
Operator Precedence
Program Comments

  1. Documentation Comments 




Ebook Preview
Get the ebook now (1.96 MB)

If the link above doesn't work, try the link below


Mirror: Get the ebook now (1.96 MB)

Leave a Reply

You can leave a comment to request any article(s), software(s), ebook(s) or report the dead link.
Then I will reply as soon as I can :)

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Recent Post

Recent Posts Widget
Instagram

- Copyright © Madriva -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -