Hacker News new | ask | show | jobs
by csours 1060 days ago
` package foo;

public class Hello {

public static void main(String[] args){

System.out.println("hi world"); } } `

#As for the build and run,

javac foo/Hello.java

java foo.Hello

---

Structure

You need: a package*, a class*, and a main method*

3

Code

The package needs to match the folder* : 1

The class needs to be public* and match* the file name; Main method needs public* and static* and take an array of String args*; you need to remember the call to output to console* : 6

Build and Run

Have to remember javac* and java* : 2

javac and java have to be available when you call them

0 - 10 [10 if you have corporate IT managed machine] (I'll call this 1)

Remember where to put the package for each call : 2

---

So I only got 15. I could have probably got more if I tried. Just because each of those 15 things is trivial by itself, does not mean you can ignore them.

I got to do 'the algorithm game' with middle-schoolers. I was the "Peanut Butter and Jelly Sandwich Robot". I took their instructions literally. It was a hoot. It's less fun when the computer isn't trying to help you.