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