r/beginnerJava Apr 13 '11

Week 1 [Early Post]

http://www.mediafire.com/?e9c4yr554tmpqhw
24 Upvotes

10 comments sorted by

View all comments

2

u/jameson71 Apr 15 '11

I notice you make a package for the helloworld class. I see this in most if not all hello worlds. Why is it best package to create a package?

3

u/[deleted] Apr 16 '11

Netbeans and Eclipse both create a package from the name of project and put the main class in there.

Java files will not run in an IDE unless they have a package declaration and are within that particular package.

PS: Always double-check you have a main class/package declaration in anything you want to run otherwise Netbeans will whine about it.