Web hosts - Chapter 2 Introduction to Java Applications 57 1

Chapter 2 Introduction to Java Applications 57 1 // Fig. 2.1: Welcome1.java 2 // A first program in Java. 3 4 public class Welcome1 { 5 6 // main method begins execution of Java application 7 public static void main( String args[] ) 8 { 9 System.out.println( “Welcome to Java Programming!” ); 10 11 } // end method main 12 13 } // end class Welcome1 Welcome to Java Programming! Fig. 2.1 A first program in Java. Good Programming Practice 2.1 Use comments to clarify difficult concepts used in a program. A comment that begins with //is called a single-line comment, because the comment terminates at the end of the current line. A //comment can also begin in the middle of a line and continue until the end of that line. Multiple-line comments can be written in two other forms. For example, /* This is a multiple line comment. It can be split over many lines */ is a comment that can spread over several lines. This type of comment begins with delimiter /* and ends with delimiter */; this type of comment may be called a multiple-line comment. All text between the delimiters of the comment is ignored by the compiler. A similar form of comment called a documentation comment is delimited by /**and */. Common Programming Error 2.1 Forgetting one of the delimiters of a multiple-line comment is a syntax error. Java absorbed comments delimited with /*and */from the C programming language and single-line comments delimited with // from the C++ programming language. Java programmers generally use C++-style single-line comments in preference to C-style comments. Throughout this book, we use C++-style single-line comments. The documentation comment syntax (/** and */) is special to Java. It enables programmers to embed documentation for their programs directly in the programs. The javadocutility program (provided by Sun Microsystems with the Java 2 Software Development Kit) reads those comments from the program and uses them to prepare your program s documentation. There are subtle issues to using javadoc-style comments properly. We do not use javadoc-style comments in the programs presented in this book. However, javadoc-style comments are explained thoroughly in Appendix F. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision virtual web hosting services

Leave a Reply