Java
  Home arrow Java arrow Page 3 - Java Beginning Programming
FaxWave - Free Trial.
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Java Beginning Programming
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 15
    2007-09-18

    Table of Contents:
  • Java Beginning Programming
  • Terminology
  • Creating the Goodbye Cruel World application
  • Understanding the Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Java Beginning Programming - Creating the Goodbye Cruel World application
    (Page 3 of 4 )

    To start, you will need to create a source file. Left-click on your Start menu and choose All Programs>Accessories>Notepad. When your document opens, type the following code:

    Note: All code is case-sensitive, so be sure to type it in exactly as you see it.

    /*
    * This application will print the words “Goodbye Cruel World” across
    * your monitor. Also note that these are just comments in your code
    * for other programmers, and is invisible to the compiler.
    */

    class GoodbyeCruelWorldApp {
      public static void main(String[] args) {
        System.out.println("Goodbye Cruel World!"); // Displays the string.
      }
    }

    Save the notepad file to your C: drive (it typically does not matter where you store the file. But in this case we will use your C: drive) under the name "GoodbyeCruelWorldApp.java", being sure to include the quotation marks. Then close your saved file.

    Next we must change your source file into a .class File. To do this, left-click on your Start menu and choose the Run command. Type cmd into the pop-up box and press Enter. This will load the Command window, shown below:

     

    In order to compile your Source File, you must change the directory to where your file is located. In the above example the prompt is set to your C: Drive. To change the directory, type cd C: and press Enter.

    Next, to display the files within your C: Drive, type dir

    You are now able to compile. In the prompt line type javac GoodbyeCruelWorldApp.java and press Enter.

    If you type in dir again, you will see the new file, GoodbyeCruelWorldApp.class.

    You are now ready to run your first program!

    Running Your First Program

    Without changing your directory, type java GoodbyeCruelWorldApp at the prompt.

    This should display the text: “GoodbyeCruelWorld!” in the prompt window.

    More Java Articles
    More By James Payne


       · The last example is missing a semicolon @ num=4000and in public static...
       · Hey thanks for catching that one...not sure how I missed it. -James Payne
       · Thank you for taking the time to read my article covering the basics of Java...
       · This information is not understood by me & my friends. So please stop your new...
       · Hey, sorry you didn't like my article. I try to make em easy to understand, but...
     

       

    JAVA ARTICLES

    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup
    - Using RPC-Style Web Services with J2EE
    - Integrating XML with J2EE
    - Taming Tiger: Concurrent Collections
    - Combating the ‘Object Crisis’

    Iron Speed



    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway