Beginners Java challenge: Write “Hello” World”

We recently discussed with several people the fact the Eclipse IDE makes coding so simple that people actually lose the ability to write (Java) code without an IDE.

So for the next few weeks I will post a few simple non-IDE Java challenges.

This is the beginners Java challenge of the week:

Take a piece of paper and write down a Java program which prints the String “Hello World” to the console. Use packages.

Once done, type your code into Eclipse and check if your paper Java version was correct.

Were you successful?

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, With more than one million visitors per month his website vogella.com is one of the central sources for Eclipse and Android programming information.
This entry was posted in Java and tagged . Bookmark the permalink.

19 Responses to Beginners Java challenge: Write “Hello” World”

  1. George Graves says:

    Started learning Java in ’99, I was compiling code with javac. Boy that was some of the most frustrating days of my career. Wait that’s not true. Trying dynamically load a jar file using RCP.

  2. Stefan says:

    Done :-)

  3. Daniel Milosevic says:

    My college ruled 8.5×11 sheet of paper does not have code completion!

    I had:
    class HelloWorld{
    public static void main(String args) {
    System.out.println(“Hello World!”);
    }
    }

    Whats wrong? forgot the string array!

    class HelloWorld{
    public static void main(String[] args) {
    System.out.println(“Hello World!”);
    }
    }

    Damn you pencil and paper!

  4. Lars Vogel says:

    @Daniel :-) Thanks for sharing.

  5. Thomas says:

    Weren’t packages part the task?

    package challenge1;

    class HelloWorld{
    public static void main(String[] args) {
    System.out.println(“Hello World!”);
    }
    }

  6. Lars Vogel says:

    @Thomas: I liked the fact that Daniel admits that he made an error. I think it is rare that people admit such a thing.

  7. Thomas says:

    @Daniel, @Lars: Ups sorry for that.

  8. Lars Vogel says:

    @Thomas: Thanks for sharing the solution. ;-)

  9. Siriquelle says:

    package ac.uk.escape;

    //Demonstrates escaping the quotation character..

    public class Escape{

    public static void main(String [] args){
    System.out.println(“\”Hello\” World\””);
    }

    }
    //This is what you meant right.. also.. I’ve not test compiled…

  10. slabounty says:

    ruby -e ‘puts “hello world”‘

    No IDE, no compiler.

    Sorry, couldn’t resist.

  11. Lars Vogel says:

    @Siriquelle Excellent, you took it literally. :-)

    @slabounty Unfortunately you failed the test. ;-)

  12. Veera says:

    I sometimes takes up this practice of writing code on paper, not only to remember coding with out an IDE, but to improve my hand writing too.

  13. ojopojo says:

    @Siriquelle : one little thing, package name

    do you think it is better to name package as uk.ac.escape instead of ac.uk.escape

  14. Riccardo says:

    Done, I also am one who learned Java back in the days, the hard way, with Notepad and javac :-)

  15. George Graves says:

    @Lars how did you do on your own test?

    I forgot to follow the instructions myself.

    My attempt

    package com.ggraves.bjc;

    public class HelloWorldPaperChallenge
    {
    public static void main(String[] args)
    {
    System.out.println(“Hello World”);
    }
    }

  16. Lars Vogel says:

    @George: I did well but I think this was easy as I was making the challenge. ;-)

  17. afon says:

    Yes! Thanks for this :)
    The fact is that we loosing basic knowledges of language and not only beacause using an IDEs. We learn frameworks, technologies and forgot about language as is. Sadly.

  18. Frank Smith says:

    It similar to people “loosing” (losing) their spelling ability due to availability of spelling and grammar checkers. ;-)

  19. Lars Vogel says:

    @Frank: Thanks, fixed.

Comments are closed.