Results 1 to 6 of 6
  1. #1
    headsup's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    Pa
    Posts
    1,232
    Reputation
    8
    Thanks
    208
    My Mood
    Cynical

    Post A closer look at Hello World App.

    In this tutorial i will show you How Hello world works..

    Now that you've seen the "Hello World!" application (and perhaps even compiled and run it), you might be wondering how it works. Here again is its code:

    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }


    The "Hello World!" application consists of three primary components: source code comments, the HelloWorldApp class definition, and the main method. The following explanation will provide you with a basic understanding of the code, but the deeper implications will only become apparent after you've finished reading the rest of the tutorial.


    Source Code Comments


    The following bold text defines the comments of the "Hello World!" application:

    /**
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    */
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }

    Comments are ignored by the compiler but are useful to other programmers. The Java programming language supports three kinds of comments:

    /* text */
    The compiler ignores everything from /* to */.

    /** documentation */


    This indicates a documentation comment (doc comment, for short). The compiler ignores this kind of comment, just like it ignores comments that use /* and */. The javadoc tool uses doc comments when preparing automatically generated documentation. For more information on javadoc


    // text
    The compiler ignores everything from // to the end of the line.


    The HelloWorldApp Class Definition

    The following bold text begins the class definition block for the "Hello World!" application:

    /**
    * The HelloWorldApp class implements an application that
    * simply displays "Hello World!" to the standard output.
    */
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }

    As shown above, the most basic form of a class definition is:

    class name {
    . . .
    }

    The keyword class begins the class definition for a class named name, and the code for each class appears between the opening and closing curly braces marked in bold above.


    The main Method

    [SIZE="2"]The following bold text begins the definition of the main method:

    /**
    * The HelloWorldApp class implements an application that
    * simply displays "Hello World!" to the standard output.
    */
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); //Display the string.
    }
    }

    In the Java programming language, every application must contain a main method whose signature is:

    public static void main(String[] args)

    The modifiers public and static can be written in either order (public static or static public), but the convention is to use public static as shown above. You can name the argument anything you want, but most programmers choose "args" or "argv".

    The main method is similar to the main function in C and C++; it's the entry point for your application and will subsequently invoke all the other methods required by your program.

    The main method accepts a single argument: an array of elements of type String.

    public static void main(String[] args)

    This array is the mechanism through which the runtime system passes information to your application. For example:

    java MyApp arg1 arg2

    Each string in the array is called a command-line argument. Command-line arguments let users affect the operation of the application without recompiling it. For example, a sorting program might allow the user to specify that the data be sorted in descending order with this command-line argument:

    -descending

    The "Hello World!" application ignores its command-line arguments, but you should be aware of the fact that such arguments do exist.

    Finally, the line:

    System.out.println("Hello World!");

    uses the System class from the core library to print the "Hello World!" message to standard output. Portions of this library (also known as the "Application Programming Interface", or "API")



    There you go and This has Taken me Almost an hour do type up. Sooooo Thanks me!!!!

  2. The Following User Says Thank You to headsup For This Useful Post:

    defence14331 (03-31-2014)

  3. #2
    1337_Me's Avatar
    Join Date
    Sep 2009
    Gender
    female
    Location
    BASEMENT
    Posts
    390
    Reputation
    19
    Thanks
    50
    My Mood
    Relaxed
    Easily copy n pasted off of internet, owell gj.

  4. #3
    headsup's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    Pa
    Posts
    1,232
    Reputation
    8
    Thanks
    208
    My Mood
    Cynical
    lol really you think. Google anything see if you find this... Post results

  5. #4
    B1ackAnge1's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    455
    Reputation
    74
    Thanks
    344
    My Mood
    Cynical
    Last edited by B1ackAnge1; 10-22-2009 at 03:29 PM.

  6. The Following User Says Thank You to B1ackAnge1 For This Useful Post:

    why06 (10-22-2009)

  7. #5
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by B1ackAnge1 View Post
    Oh wow. that was hilarious. kudos BA. LOL. Too bad the kids already banned. I would have liked to have seen his reply really :P

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  8. #6
    Katbox's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    15
    Reputation
    10
    Thanks
    1
    My Mood
    Amused
    I got a good lol out of this one.

Similar Threads

  1. Hello World Disassembly
    By why06 in forum Assembly
    Replies: 15
    Last Post: 01-21-2010, 09:21 AM
  2. New o C++? Simple Hello world (Added a little extra)
    By headsup in forum C++/C Programming
    Replies: 10
    Last Post: 11-09-2009, 06:00 PM
  3. Hello World Anyone?
    By B1ackAnge1 in forum Assembly
    Replies: 11
    Last Post: 11-09-2009, 01:14 PM
  4. Nexons new Hacking fine, a closer look
    By jared808 in forum Combat Arms Hacks & Cheats
    Replies: 44
    Last Post: 05-04-2009, 11:23 PM
  5. [C++]Hello World; Your first C++ Program
    By Mr. Bond in forum Programming Tutorials
    Replies: 3
    Last Post: 02-09-2009, 08:53 AM

Tags for this Thread