Basic Java Language: Difference between revisions
wikademia>Crossbow9 No edit summary |
wikademia>Crossbow9 |
||
| Line 64: | Line 64: | ||
<pre>System.out.println("Hello World");</pre> | <pre>System.out.println("Hello World");</pre> | ||
This line of code prints ''Hello World'' onto the console. | This line of code prints ''Hello World'' onto the console. | ||
==Comments== | |||
Comments are notes that the developer can insert into their code. This allows the developer to keep track of their code and helps when developers are collaborating on a project. It is good to write a summary of the following code at the beginning of your methods, classes, etc. The Java compiler completely ignores comments, so you can say anythiing in them | |||
Comments are written using two forward slashes | |||
<pre>//This is a comment</pre> | |||
Comments can be written at the end of a line | |||
<pre>System.out.println("I love comments"); //This is also a comment</pre> | |||
Comments can also be written on multiple lines by starting with '''/*''' and ending with'''*/'''. | |||
<pre>/* Comment 1 | |||
Comment 2 | |||
Comment 3 */</pre> | |||
==Operators== | ==Operators== | ||
===Equality Operator = === | ===Equality Operator = === | ||
| Line 75: | Line 87: | ||
a = b;</pre> | a = b;</pre> | ||
At first glance, you might think that the last statement is setting ''a'' equal to the letter "b", but instead it is setting ''a'' equal to the ''value'' of ''b'', which is 6. | At first glance, you might think that the last statement is setting ''a'' equal to the letter "b", but instead it is setting ''a'' equal to the ''value'' of ''b'', which is 6. | ||
'''More comming soon''' | |||
[[Topic:Java|Back to Java Main Page]] | [[Topic:Java|Back to Java Main Page]] | ||