eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak

 

Introduction to Web Programming
Comments  
  • Just as you could use the number sign (#) to let the Perl interpreter know that a line in the codewas a comment, you can specify comments in Java

  • Actually, there are several ways todenote comments in Java

  • For single line comments, you can use the "//" notation. For example, consider the following code:

    		// Initialize variables...
    int age = 28;	// Declare and initialize age
    

  • Single line commentscan be defined on the same line as your code or on their ownline

  • To specify multiline comments, however,you will use the "/*" and "*/" combination such as in the followingexample:

    /*
    This is a sample class which is used to demonstratethe use of multi-line comments.
    It was written by Selena Sol for the Web Programming Tutorial
    */
           // Define an Example class with a single
           // main() method which will print out
           // "Hello Cyberspace!" to standard output.
    public class Example
      {  public static void main(String[] args)
         {    System.out.println("Hello Cyberspace!");
        }
      }
    

  • As you can see, if you use the "//" notation and your comment spans multiple lines,
    you must begin each new line with a "//" combination.

  • Finally, if you are writing comments which should be included as part of a javadoc document, you should use the "/**" "*/" combination such as in the followingexample:

    /*
    This is a sample class which is used to demonstratethe use of multi-line comments.
    It was written by Selena Sol for the Web Programming Tutorial.  This commentdoes not appear in the java documentation
    */
             /**
             Define an Example class with a single
             main() method which will print out
             "Hello Cyberspace!" to standard output.
             This comment appears in the javadoc.
            */
    
    public class Example
      {
      public static void main(String[] args)
        {
        System.out.println("Hello Cyberspace!");
        }
      }

Previous Page |Next Page