Variables

In Java, just like in almost any programming language, we use variables. The variables in Java are typed. It means that a variable can hold a value of a single type. It is not possible for a variable to hold an int type at some point in the program and later a String type. When variables are declared, their type is written in front of the variable name.

Variables also have visibility scope. Local variables in methods can only be used inside the block in which they are defined. A variable can be used inside methods or they can belong to a class or an object. To differentiate the two, we usually call these variables fields.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.4.191