This article introduces variables. Variables are inevitable in programming. After all, programming involves manipulating variables and exchanging information about what happens.
In Java, variables are defined as types. There are various types such as "this is a character string type", "integer type", and "real number type". When listing
Mold | contents |
---|---|
String | String |
int | integer |
double | Real number |
boolean | True or false |
There are others, but you should know this much.
Variables are not something you can use in Java. Before using it, you must declare that you will use this character in a variable of this type.
double a;
int b = 2;
String c;
boolean d;
By doing this, for example, a variable
a = 0.5;
a = a + 1.2;
You can operate with. At this point the variable a is 1.7. You can also decide the value of the variable when you declare it, or you can enter the value later.
By the way, it is null when there is nothing in the variable.
In the future, I will explain about Java. I don't think you can understand anything in the current state. However, I have introduced variables just in case. Next article About the class (please wait)
Recommended Posts