Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Java >> Snippet

05 Variables


Variables are strongly typed.  You must define the data type of a variable.
Java is case - sensitive.  Dog, dog, and DoG can co - exist.

int A ;
int A = 5 ;

String MyName ;
String MyName = "Gary" ;

String Name = "Harvey" ;         //use double quotes around String
char MyChar = 'C' ;                    //use single quotes around char data type
boolean decision = false;

Variable names begin with letter, underscore, or $
avar
$var
_var

Data types supported include :

boolean
byte
char
short
int
long
double