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?
April 5th, 2010 at 2:34 am
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.
April 5th, 2010 at 11:45 am
Done
April 5th, 2010 at 5:44 pm
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!
April 5th, 2010 at 7:29 pm
@Daniel
Thanks for sharing.
April 6th, 2010 at 8:15 am
Weren’t packages part the task?
package challenge1;
class HelloWorld{
public static void main(String[] args) {
System.out.println(“Hello World!”);
}
}
April 6th, 2010 at 8:32 am
@Thomas: I liked the fact that Daniel admits that he made an error. I think it is rare that people admit such a thing.
April 6th, 2010 at 11:52 am
@Daniel, @Lars: Ups sorry for that.
April 7th, 2010 at 12:06 am
@Thomas: Thanks for sharing the solution.
April 7th, 2010 at 2:01 am
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…
April 7th, 2010 at 3:56 am
ruby -e ‘puts “hello world”‘
No IDE, no compiler.
Sorry, couldn’t resist.
April 7th, 2010 at 4:15 am
@Siriquelle Excellent, you took it literally.
@slabounty Unfortunately you failed the test.
April 7th, 2010 at 9:17 am
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.
April 7th, 2010 at 10:54 am
@Siriquelle : one little thing, package name
do you think it is better to name package as uk.ac.escape instead of ac.uk.escape
April 7th, 2010 at 3:43 pm
Done, I also am one who learned Java back in the days, the hard way, with Notepad and javac
April 8th, 2010 at 2:20 am
@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”);
}
}
April 8th, 2010 at 4:43 am
@George: I did well but I think this was easy as I was making the challenge.
April 8th, 2010 at 5:29 pm
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.
April 10th, 2010 at 4:37 am
It similar to people “loosing” (losing) their spelling ability due to availability of spelling and grammar checkers.
April 10th, 2010 at 6:26 pm
@Frank: Thanks, fixed.