Variables in Java - tutorial
VARIABLES IN JAVA Table of Contents Variable Comments Passing arguments to a program Rules for variable naming Casting Escape sequence characters Literals Scope of the variable What is a variable? A variable is a small memory location, where we can store a small amount of data. It can be any data type. Datatype can be alphabetical, numerical, alphanumerical… etc. ex: int a; int → is an integer datatype, it can store only numbers. a → is a variable name ex: int a,b,c; // variables declration c = 0 ; // initialization a = 5 ; b = 10 ; To display the value of the variable use the following statement. System. out . println (a); // 5 System. out . println ( "a=" + a); // o/p is a= 5 Comments: we write our own comments in program. They ...