homecode zoneQuick Codedownloadssubmit codeabout usfeedbackscontact ussitemap
 
Concepts
Constant Varibles & Data Types
Operators
Pro - Languages
C/C++
Java
Visual basic
asp
vb.net 2003/2005
asp.net
Quick Code
SUBMIT CODE
Mail List
LINKS
LINK TO US
Submit LINK
 
ProgrammerGuide.net - Java Constant Variables & Data Types.
Home » Java Zone » Constant Variables & Data Types

Introduction

A programming language is designed to process certain types of data consisting of numbers, characters and strings and to provide useful output as Known information. The task of processing data is accomplished by executing a sequence of instructions contributing a program. These instruction are formed using certain symbols and words according to some rigid rules known as syntax rule of the language.

Constant

Constants in java refer to fixed values that do not change during the execution of a program. Java supports several types of Constants as given below.

  1. Integer Constant

    • 123      -321     0     654321

  2. Real Constant

    • 0.083      -0.32     453.23
       
  3. Single Character Constant

    • ‘5’     ‘x’     ‘:’     ‘ ‘
       
  4. Backslash Character Constant

    • Java supports some of special backslash character constants as given below
Constant Meaning
'\b' back space
'\f' form feed
'\n' new line
'\r' carriage return
'\t' horizontal tab
'\'' single quoted
'\"' double quoted
'\\' backslash

Variables

A variable is an identifier that denotes a storage location used to store a data value. Unlike constant that remains unchanged during the execution of a program, a variable may take different values at different times during the execution of the program.

Variable names are consist of alphabets, digits, the underscore ( _ ) and the dollar character, subject to the following conditions:

  1. They must not begin with digits.
  2. Uppercase and lowercase are distinct. This means that the variable Total is not the same as total or TOTAL.
  3. It should not be a keyword.
  4. White space is not allowed.
  5. Variable names can be of any length.

Data types

Every variables I java has a Data types specify the size and type of values that can be stored. Java language is rich in its datatypes. The variety of data types available allows the programmer to select the type appropriate to the needs of the application. Data types in Java under various categories are also called intrinsic or build-in types.

 

« Previous 1 2 3 Next »

Viewers: 17
Visitors:127297
Last Updated on:Sunday, January 17, 2010
Home | About us | Feedback | Contact us | Sitemap
Copyright © 2008 ProgrammerGuide.net. All rights reserved.
This site is best viewed in IE 6.0, Firefox 1.5 and above with screen resolution of 1024 X 768.