You can define several variables as follows:
double a,b,c;
Each variable in one line can also be assigned to a specific value:
double a=3, b=5.2, c=3.5/3.5;
Another aspect is that when preparing a general type variable on the same line, and then from the right assigned variables, you can assign the variable to the left, for example:
int a = 4, b = a+1, c=b*b;
Having noticed, you can also practice arithmetic operations on a variable, remaining in one line.
source share