|
In this part you will learn about Data
Types and Operators. Don't let that scare
you we are going to break this down and discuss it in real easy to understand English
our first section is....
Comments Like HTML you can
include comments in your code. this is very useful and there will be many
occasions when you will want to do so to speak to the person viewing your code.
The Complier doesn't see these comments they are only for people. you can use
this to do a single line comment "//"
here is an example
// this is a single line comment
you will recognise
// from your Lamers suck application and applet that you already created.
Lets revisit the lamers suck code.
/**
* The LamersSuckApp class implements an application that
* displays "Lamers Suck!" to the standard output.
*/
public class LamersSuck {
public static void main(String[] args) {
// Display "Lamers Suck!"
System.out.println("Lamers Suck!");
}
}
See its easy and you have already made your first single line comment.
Another way to comment is the multiline comment. Think
about how you open and close tags in HTML (once again if you have not taken the
html tutorials I stress you should because it will train you to start thinking
in code). Like HTML the multiline has an opener and a closer. type this to open
a multiline comment /* and
type this to close it */ its
not at all complicated its a concept like opening and closing in HTML.
If you want to include your comment as
part of the Java documentation you will make your comment by opening like this /**
and closing with */
Lets
revisit our lamer application code again eh
/**
* The LamersSuckApp class implements an application that
* displays "Lamers Suck!" to the standard output.
*/
public class LamersSuck {
public static void main(String[] args) {
// Display "Lamers Suck!"
System.out.println("Lamers
Suck!");
}
}
As you can see you have already made use of this kind of comment. Now that
you know what comments are and how to use them it is time to move on to part
2.
|