Create Variables in Java:
|We can use the Eclipse IDE for this example. If you do not know about it then follow this link- How to Install Eclipse For Java and create a program in it.|
(1) What are Variables? A Variable is a storage area that is used to store values. In other words, we can say that a variable is the name of a memory location. It has a name, a type, and a value. Before one uses a variable, it has to be declared, and once declared the values can be assigned to it. For example, you might want the name x to represent 100. To make it so, simply execute the following.
(2) Rules of Variable Naming Convention in Java:
- Variable are case-sensitive i.e. the lower case variable is different from the upper case and vice-versa.
- A variable name can be any legal identifier.
- It can contain Unicode letters, Digits, and Two Special Characters such as Underscore and Dollar Sign.
- The length of the variable name can be any number.
- It’s necessary to use Alphabet while creating a variable.
- Some auto-generated variables may contain a “$” sign. But try to avoid using the Dollar sign.
- White space is not permitted.
- The variable does not use any Special Characters.
- A variable name cannot start with a Digit.
- A keyword or reserved word cannot be used as a variable name.
(3) Use Different Types of variables and data types: A data type is an attribute of data that tells the compiler or interpreter how the programmer intends to use the data or value. It specifies the size and type of values that can be stored in a variable. For example- String– stores text, int– stores integers, float– stores floating point numbers, char– stores single characters, boolean– stores values with two states: true or false, etc.
FTP (File Transfer Protocol)
World Wide Web (WWW)
Internet and Its Uses
Applications of Computer
Characteristics of Computer
Java (programming language)– Wikipedia