Basic Java Language: Difference between revisions

wikademia>Crossbow9
No edit summary
wikademia>Crossbow9
No edit summary
Line 39: Line 39:
|}
|}
</center>
</center>
==Declaring Variables==
In a nutshell, declaring a variable has this syntax:
<pre> [variable type] [identifier]</pre>
This works for both reference variables and primitive variables. [variable type] is the type of variable, like '''int''' or '''char'''. [identifier] is the name for the variable you wish to create, for example, ''password'' or ''number_of_fish''. If you wanted to create a '''int''' variable called ''age'', you would type this:
<pre>int age</pre>


[[Topic:Java|Back]]
 
 
[[Topic:Java|Back to Java Main Page]]