Redemption
Forum Addict

This guide teaches you how to make a program that displays "Hello World!" in the applet without using objectdraw. If you're a beginner, objectdraw is easier. If you want to see the basics of Java. Look at my objectdraw guides. If you want the real thing, this is a good place to start.
First, you'll need a text editor. You can use notepad, but it will be much less neat and harder to read. I recommend using TextPad, because it automatically formats the code for you. It makes it a lot easier to understand long code.
TextPad can be found here.
Let's start out with the full code.
Ignore this next paragraph if you didn't read my objectdraw guides-
As you can see, this is only a tiny bit of code. If you used my objectdraw guides, there was a lot more there. This is because objectdraw shortens it out into easily memorized code. Yeah, it's kinda gay trying to go from objectdraw to regular java without includes, but you'll get used to it.
If you haven't read my objectdraw guides can start reading here. Those who have may continue-
So, let's start at the beginning.
This part of the code tells that you're starting up a new class (program, basically) to be used throughout the whole program (public) called HelloWorld. After this part of the code, you'll see an open bracket. This means that the code in between that and the end bracket have to do with the class. Easy enough?
**Whatever you name your class, you *must* name your java file! For example, in this program, you must save your file as HelloWorld.java. If you don't, you will get an error that will piss you off. In fact, you'll probably never figure it out.
Okay, let's move on.
Here, you are declaring a void, which basically means a part of the program that is usable within the applet. The stuff around "void" needs a bit of explanation. Let's break it down.
public- means it will be used throughout the whole program and can be used more than once. This should begin almost every void you declare.
static- means the void can *never* change. You don't need to add static, I just wanted to teach you what it means.
main- self explanatory. Let me know if you don't understand it fully.
(String[] args)- It tells java there is a string of characters that will be used. A string is letters or numbers to be displayed on the applet. Our string in this program is "Hello World!".
{ - Shows it where the code is. Between this and the end bracket is where the program for this specific void goes.
Let's move on again.
This tells the system to print into the canvas the string "Hello World!". I think it's easy enough to understand. Afterwards, though, you'll see a semicolon. This tells it that that line is done. DO NOT PUT A BRACKET!
Let's move on... again...
This is a comment, which is basically a statement java ignores. This will have no effect on your program, it will just make it easier for the coder to remember what he or she was doing.
Let's wrap it up...
The first bracket tells java that the void code is finished. The second bracket ends the class. If you were to have another void, it would go in between these two brackets, saying that the first void was over, but the class is still going. Then, at the end, there would be two brackets. The first one closing the second void, the second closing the class.
So, there you go. If you had any trouble understanding this, gimme a PM. I'll get back to you when I can.
First, you'll need a text editor. You can use notepad, but it will be much less neat and harder to read. I recommend using TextPad, because it automatically formats the code for you. It makes it a lot easier to understand long code.
TextPad can be found here.
Let's start out with the full code.
Code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
//prints Hello World! on the canvas
}
}
Ignore this next paragraph if you didn't read my objectdraw guides-
As you can see, this is only a tiny bit of code. If you used my objectdraw guides, there was a lot more there. This is because objectdraw shortens it out into easily memorized code. Yeah, it's kinda gay trying to go from objectdraw to regular java without includes, but you'll get used to it.
If you haven't read my objectdraw guides can start reading here. Those who have may continue-
So, let's start at the beginning.
Code:
public class HelloWorld {
This part of the code tells that you're starting up a new class (program, basically) to be used throughout the whole program (public) called HelloWorld. After this part of the code, you'll see an open bracket. This means that the code in between that and the end bracket have to do with the class. Easy enough?
**Whatever you name your class, you *must* name your java file! For example, in this program, you must save your file as HelloWorld.java. If you don't, you will get an error that will piss you off. In fact, you'll probably never figure it out.
Okay, let's move on.
Code:
public static void main(String[] args) {
Here, you are declaring a void, which basically means a part of the program that is usable within the applet. The stuff around "void" needs a bit of explanation. Let's break it down.
public- means it will be used throughout the whole program and can be used more than once. This should begin almost every void you declare.
static- means the void can *never* change. You don't need to add static, I just wanted to teach you what it means.
main- self explanatory. Let me know if you don't understand it fully.
(String[] args)- It tells java there is a string of characters that will be used. A string is letters or numbers to be displayed on the applet. Our string in this program is "Hello World!".
{ - Shows it where the code is. Between this and the end bracket is where the program for this specific void goes.
Let's move on again.
Code:
System.out.println("Hello World!");
This tells the system to print into the canvas the string "Hello World!". I think it's easy enough to understand. Afterwards, though, you'll see a semicolon. This tells it that that line is done. DO NOT PUT A BRACKET!
Let's move on... again...
Code:
//prints Hello World! on the canvas
This is a comment, which is basically a statement java ignores. This will have no effect on your program, it will just make it easier for the coder to remember what he or she was doing.
Let's wrap it up...
Code:
}
}
The first bracket tells java that the void code is finished. The second bracket ends the class. If you were to have another void, it would go in between these two brackets, saying that the first void was over, but the class is still going. Then, at the end, there would be two brackets. The first one closing the second void, the second closing the class.
So, there you go. If you had any trouble understanding this, gimme a PM. I'll get back to you when I can.

