Real World XML (2nd Edition)
As with JavaScript, you can comment your Java code. Comments serve the same purpose here as they do in XML and JavaScript: They hold descriptive code that explains what's going on in your code. There are two ways to insert comments in a Java program. The first way is to surround comments, especially multiline comments, with the characters /* and */ , like this: /* This application is designed to display the message "Welcome to Java" on the console */ public class ch10_01 { public static void main(String[] args) { System.out.println("Welcome to Java"); } } As with any type of comment, the Java compiler ignores the text in the commentthat is, any text between the /* and */ markers. As with JavaScript, Java supports a one-line comment using a double slash ( // ). The Java compiler ignores everything on a line after the // marker, so you can create whole lines that are comments or just add a comment to an individual line, like this: /* This application is designed to display the message "Welcome to Java" on the console */ public class ch10_01 //Define the class ch10_01 { //Define main(), the first method to be called. public static void main(String[] args) { //Display the message "Welcome to Java" System.out.println("Welcome to Java"); } } |