Java syntax: Difference between revisions

Content deleted Content added
Stormgaze (talk | contribs)
updated brief description to clarify association with Java specifically
No edit summary
Tags: Mobile edit Mobile web edit
Line 207:
 
<syntaxhighlight lang="java">
int count; // Declaring an uninitialized variable called 'count', of type 'int'
count = 35; //Initializing the variable
int count = 35; // Declaring and initializing the variable at the same time
</syntaxhighlight>
 
Multiple variables of the same type can be declared and initialized in one statement using comma as a delimiter.
<syntaxhighlight lang="java">
int a, b; // Declaring multiple variables of the same type
int a = 2, b = 3; // Declaring and initializing multiple variables of the same type
</syntaxhighlight>