Joel Explains: Java
Compiler vs. Interpreter
Compiler – Checks syntax.
Interpreter – Checks syntax.
Compiler – Generates machine-code instructions. Running the program is a separate step.
Interpreter – Executes the program statements as it converts them to machine-code.
Compiler – Is not needed to run the executable program.
Interpreter – Must remain installed while program is run.
Compiler – Runs faster.
Interpreter – Is slower.
Generally, when you compile a program, you’re creating machine language for a specific platform. For example, you might compile a program to run on a Windows 2000 platform. If you want to run the same program on an Apple computer, you can use a compiler that creates machine language for a Mac OS X platform.
When you compile a Java program, it doesn’t create machine language, it creates bytecode. To run a Java program, the computer running the program needs a Java Virtual Machine to convert the bytecode into machine language. This arrangement allows you to write once, then run anywhere that has a Java Virtual Machine.
Java programs can be written in any text editor, such as Microsoft Notepad. When you save a Java program, you should save it with a .java extension. For example, if you were to create a program that writes the famous phrase “Hello world“, you might save it as HelloWorld.java.
In addition to using the .java extension, you should use UpperCamelCase for the program name. CamelCase is the practice of writing compound words or phrases where the words are joined without spaces or dashes or underscores, and each new word is capitalized. The name comes from the camel-like “bumps” in the middle of the compound word that are created by the uppercase letters. When you name something in CamelCase that starts with a lower case letter, it’s referred to as lowerCamelCase. In Java, there’s a convention that you should use lowerCamelCase for variable names. On the other hand, names starting with an upper case letter are referred to as UpperCamelCase. The compiler, however, doesn’t care which case you use for any of these names, as long as you are consistent.
To compile Java programs using the Standard Edition of the Java 2 platform, you need to download the current JDK.
To compile HelloWorld.java, you type in javac HelloWorld.java at the MS-DOS Prompt (in Windows 95/98) or Command Prompt (in Windows NT/XP/Vista). This will create bytecode in HelloWorld.class.
To run HelloWorld.class, you type java HelloWorld.class.
A HelloWorld program could look like this:
class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
The first line starts with the word class. This is just a reserved word that tells java that we’re building a new class. The other word on the first line is HelloWorld. This is the name that we have chosen for this class, and it MUST match the program name. By convention, all class names should be UpperCamelCase so programmers will recognize that it is a class name, not a variable name. The entire first line is a class header.
The second line of the program is an opening curly brace. This defines the beginning of the class body. The last line of our program is a closing curly brace. This indicates the end of our class. Everything between these two curly braces is part of class HelloWorld.
The HelloWorld class contains one method. Method is just another name for something that is called a function, procedure, paragraph, or subroutine in other languages. It’s a block of code that can be called from another location. In this case, it’s called from the run statement. All java applications start at a method named main().
The third line is a method header for the main() method. It’s followed by curly braces that define the body of the method and enclose a println statement that sends the literal “Hello World” to the screen.
This particular method starts with the word public. Public is an access modifier. It lets Java know who’s allowed to call this method. Public is the least restrictive access modifier.
The next word is static. Static changes main() from an instance method to a class method. Yes, I understand that you don’t know what this means yet.
Static is followed by the word void, which indicates that the main method doesn’t send a value back to the place that called it. If it did return a value, we would replace the word void with the data type of the returned value.
The method body contains a single statement:
System.out.println(”Hello World”);
It ends with a semicolon. All statements end with a semicolon. Class headers and method headers are not statements.
The word System is a class. It starts with an uppercase letter.
The word out is an object.
The word println() is a method.
The statement System.out.println(); is a method call.
The statement System.out.println(”Hello World”); is a method call that passes a literal argument to the method.
If you’ld like to try it for yourself, here are some good instructions and a closer look at a Hello World program from the folks at Sun.
A good learning path would be to continue writing Applications.
Once you have a good foundation writing applications, you can start learning about Applets.
Running Applets and Building Applets can be more fun than building applications.
At some point, you may want to start using an Integrated Development Environment.
Here are some Java Tips and someStep by Step Programming Tutorials.
You may also want to learn more about the AWT and Swing
Lecture Notes from Intro to Computing at the Free University of Bolzano/Bozen.






In the past I used waxing to eliminate my excessive hair however it was so stressfull that I needed to give it up. I gave electrolysis a go and it worked fair but was sort of inconveinant. So I looked forever researching tria and was really pleased. I actually bought the no no and was extremely satisfied with the final outcome. It gave me complete hair removal at an fantastic fee. I certainly recommend it to someone before stringing.
Thanks, practically never thought of utilizing these suggestions to make big savings
Simple to lower your expenses with these types of techniques
Nice blog you have here. Interesting articles. Keep up the good work.
Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information.
I just found your website through Google. You have some pretty nice articles here that I`ve already bookmarked so I can check out your website regularly. Keep up the good work. Thanx !
I’ve been observing your website for a month or so and also have found a pile of useful data. I am undertaking to operate my personal blog on the other hand I believe its too general and I would like to focus more about smaller subject areas.
A really good approach to this you possess, whereas I do not agree with every thing which has been explained I can see your case.
Thanks offering this
I know this is really boring and you are skipping to the next comment, but I just wanted to throw you a big thanks – you cleared up some things for me!
It’s not common these days to find this type of information. I’m glad I stumbled upon your website. Keep up the good work!
I think your opinions are quite interesting, I enjoy reading what you write. Hope to hear more from you. Subscribed.
What hosting company are you using for your blog?
I really like this post, would you provide more information?
Valuable info. Even I accidentally found your site, I bookmarked it.
The glory of extensive men should every time be slow by means of the means they have utilized to into it.
It’s not common these days to find this type of information. I’m glad I stumbled upon your website. Keep up the good work!
Kudos from one brainiac to another.
Hi, there. I would suggest you continue writing more posts, this would make your blog even more interesting, plus I guess you will get more visitors.
Great stuff ici.
Should I buy steel golf clubs or graphite ?
Very Interesting Post! Thank You For Thi Blog!
Great stuff from you, man. Ive read your stuff before and youre just too awesome. I love what youve got here, love what youre saying and the way you say it. You make it entertaining and you still manage to keep it smart. I cant wait to read more from you. This is really a great blog.
Which Golf Clubs Are Better – Steel or Graphite ?
I stumbled across your blog, and think it’s fantastic, keep us posting
I feel you are too good to write Genius!Thanks for posting, maybe we can see more on this.
Hi, there. I would suggest you continue writing more posts, this would make your blog even more interesting, plus I guess you will get more visitors.
I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more soon mate
I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.
Should I buy steel golf clubs or graphite ?
This is the best blog, i’ve ever seen, bookmarked
I’ve been visiting your blog for a while now and I always find a gem in your new posts. Thanks for sharing.
We appreciate the ease of requesting an interpreter online, indicating the date and time of a patient’s appointment and whether the interpreter needs to call a patient ahead of time with an appointment reminder. We can check our invoice history and make sure they’ve assigned an interpreter to the appointment. Also if the patient cancels we can reschedule or cancel the service requests directly online.
We appreciate the ease of requesting an interpreter online, indicating the date and time of a patient’s appointment and whether the interpreter needs to call a patient ahead of time with an appointment reminder. We can check our invoice history and make sure they’ve assigned an interpreter to the appointment. Also if the patient cancels we can reschedule or cancel the service requests directly online.
Random question: I am starting my own blog to share my photography experiences. Do you find it hard or easy to post consistently?
I like the way you put out things. It would be nice to read more posts from you. Bookmarked.
Awesome Post. I add this Post to my bookmarks.
You certainly deserve a round of applause for your post and more specifically, your blog in general. Very high quality material.
This is certainly one of the most remarkable blogs I have seen. It’s so painless to tune out, but there is honestly some unparalleled information online, and I think your site is one of the few!
Unquestionably the Sex Chatroulette regard has gotten a group of open location for your internet and tv. In all representing this Sex Chatroulette aspiration seems.
Great text and nice blog.
buy klonopin online
Should I buy steel golf clubs or graphite ?
Very Interesting Information! Thank You For Thi Blog!
Just got my first tatoo
Nice Article, thanks. Can you explain on the second paragraph in a little more detail plz?
well written article, i just bookmarked it for later. i would like to revisit on future posts. how do i set the rss again? thanks!