Friday, November 16, 2012

Coding HelloWorld.

Hey, readers. I'm back with some more news, more progress and a couple photos. So I know that I left you guys (and girls) a bit confused with my last post but I'm back to rectify that.

So assuming that you guys have managed install Java and set up the variables (see my previous post if you haven't), we begin the process of coding. The first thing to be done is to create a place to store the code.

 In the event  you can't read that, here it is:

C:\Users\Justin G> C:
C:\Users\Justin G>md\JavaProjects
C:\Users\Justin G>cd\JavaProjects
C:\JavaProjects>md session1
C:\JavaProjects>md session2
C:\JavaProjects>cd session2

You won't have to type in C:\Users\(Your account name)> every time. That comes up automatically.

So now what you have done is that you have a create a space to store the program and run the compiler.
The next thing you are going to input is: notepad HelloWorld.java (it doesn't have to always be HelloWorld. It is the name of the program that you are going to compile then run.) This will open up a new file in Notepad. This pop-up is where you will be where you write your own code. Now, for Hello World, the code is fairly simple.

                      *Note that my program is called Welcometomyworld.java and that I have ("Welcome to my world...") instead of HelloWorld. That is fine. You can set the program to print anything written in the ().

 Make sure that this code is input EXACTLY as seen or the program will come up as an error.  Please note that it is necessary to SAVE your text. This is something I had to learn the hard way...namely by glaring at my computer for about a while.  Moving on...

Next go back to  Command Prompt. Type in  <javac HelloWorld.java>. Note that <> simply mean what you are inputting. You do not need to type < nor >. This compiles the program. Now you maybe be asking what a compiler does. Simply put, a compiler changes the programming text into a language that the computer understand. For a more in- depth description, see here: Compiler.

 Now that the program has been complied, you can run it. Just type in <java HelloWorld>. Congratulations! You just coded your first program on Java!

As to why this important to my project, this is the beginning of programming. It's a good introduction to the  syntax along with all the programming.

Well that's all for this post. Bye!





1 comment:

  1. Hmm, I'm still a little confused. Are your posts to TEACH us how to code, or to document your progress and learning in coding?

    ReplyDelete

We appreciate your comments and feedback. Thank you for helping to improve our projects!