So, you want to be a programmer, eh? Very well; it's not nearly as hard as it looks, after all. But sometimes it is a bit difficult to find where to begin. Through this series of lessons, provided to you free of charge by the U of NE (University of New Epoch; that's pretty official, mind you,) you'll be off creating all manner of programs in no time!
The first things you're going to do is install Java on your computer. Chances are it's installed already. Most online games require it, so if you've used your computer for games before, it's probably been installed. If not, you can get it from here: http://www.java.com/en/download/index.jsp
Now then, once you have that, the next step is to choose a development environment. Now, there are quite a few available, but I find that the easiest one to use if Eclipse. You can download Eclipse from here: http://www.eclipse.org/downloads/
Once you have both of these installed, you're ready to start your first real computer program! Start up Eclipse, press File, then New, then Java Program. There will be a window asking you to name your program. Name it whatever you want. Wait, it looks like that didn't even do anything! What's going on!? HALP!
Calm down! Inside every program are a number of things called Classes. Don't worry about that for now; every program we write for the next while will only have a single class. So, do you see the folder with the name of your program on the left panel? Highlight that by clicking on it, then go back to File, New, and this time, choose Class. Name it whatever you'd like. ALSO. Before you click Okay, make sure that you check the top box in the lowest group of three. It should say something like "Create main (string[args])" or something like that. This'll save you a bit of typing later.
Now that you've created your class, you should be able to see your coding window. It looks a lot like any other text editor, such as Notepad, but, with the additional feature of color-coding your code, as well as helping you write it by guessing what you're going to write next.
Since this is our first program, let's start with something simple. In between the module brackets (the things that look like these { },) type this statement:
System.out.println("Hello World!");
Make sure you capitalize everything right, and use the correct punctuation, including the semi-colon at the end of the command.
Congratulations, you just wrote your first computer program! Let's try running it and see what it does, shall we? In the top toolbar of Eclipse, you'll see an arrow in a green circle. That's the button to run your program. It's always good to run your program a lot while you're working on it, even if it isn't finished, because it will help you make sure that you have coded everything correctly and not made any silly mistakes. Running the program also saves your work, so that makes it even better. Anyway, once the program is running, you'll see what it does in the bottom part of the Eclipse window. This is called the Console. This is where everything the program does happens. Later, we'll learn how to make a GUI, which is the buttons and text boxes and stuff that you see on most finished programs. For now, the console will be just fine. If you did everything correctly, the console should display:
Hello World!
Good work! However, if something didn't work correctly, don't panic! Eclipse is very helpful, and underlines in red anywhere it thinks you might have made a programming error. Right-clicking it will have the program give you suggestions on what you should change it to. Remember, though, that Eclipse doesn't know what it is that you're trying to program, so it's not always right! That's why it gives quite a few suggestions instead of just one.
Alright, that's it for lesson one! The main purpose of this lesson was to help you become acquainted with Java and Eclipse. Don't worry if you don't feel like you learned much; we'll be covering more material in future lessons. I'll try and post some screenshots of this lesson once I get back to my apartment, but in the meantime, if you have any questions, or need help with the Test Program, leave a comment here!
--Ben
__________________
"It needs to be about 20% cooler." --Rainbow Dash
Of course you should listen to me. Have I ever lied to you before? I mean, in this topic.
The general who is most skilled in defense hides in the deepest recesses of the earth, while the general who is most skilled in offense soars to the highest part of heaven.-Sun Tzu (The Art Of War)
Read the first paragraph before wasting your time with a comment like that. A lot of people want to learn to program, so I created a board and a topic teaching them.
So, you want to be a programmer, eh? Very well; it's not nearly as hard as it looks, after all. But sometimes it is a bit difficult to find where to begin. Through this series of lessons, provided to you free of charge by the U of NE (University of New Epoch; that's pretty official, mind you,) you'll be off creating all manner of programs in no time!
__________________
"It needs to be about 20% cooler." --Rainbow Dash
Of course you should listen to me. Have I ever lied to you before? I mean, in this topic.
No, you get to learn Java. Javascript is an entirely different programming language. What do you mean how to you get it running? Just download it, and double-click on Eclipse.exe.
__________________
"It needs to be about 20% cooler." --Rainbow Dash
Of course you should listen to me. Have I ever lied to you before? I mean, in this topic.
The general who is most skilled in defense hides in the deepest recesses of the earth, while the general who is most skilled in offense soars to the highest part of heaven.-Sun Tzu (The Art Of War)