Computer Science, asked by velmani2313, 6 months ago

Variable declaration for this program pls​

Attachments:

Answers

Answered by neetutiwari2222
0

Explanation:

variable is where a program says that it needs a variable. For our small programs, place declaration statements between the two braces of the main method.

The declaration gives a name and a data type for the variable. It may also ask that a particular value be placed in the variable. In a high level language (such as Java) the programmer does not need to worry about how the computer hardware actually does what was asked. If you ask for a variable of type long, you get it. If you ask for the value 123 to be placed in the variable, that is what happens. Details about bytes, bit patterns, and memory addresses are up to the Java compiler.

In the example program, the declaration requests an eight-byte section of memory named payAmount which uses the primitive data type long for representing values. When the program starts running, the variable will initially have the value 123 stored in it.

A variable cannot be used in a program unless it has been declared.

Similar questions