Ok, since I know, and still am, learning java, I will post a helpful tutorial on how to make your first Java program!
So first what you'll need is:
JDK(Java Development Kit)
That's about it o.o
Ok, so now let's start off by right-clicking on our desktop, and going to "New" and clicking "New Text Document"
Now name it "first" make sure the f is not capitalized.
Now, open that text document up and type this into it (Don't just C&P, you won't learn that way) and I will explain what the code means and does.
ALSO:for the first}'s DO NOT USE SPACES, USE THE TAB KEY!
Now, let's break this down into the basics
1) What you see in the /* */ is what we call a "Block Comment" which means when we compile our .java file the compiler will ignore it and not include it in the compiled .class
2) The code "public static void main(String[] args) {" means that is the main code line for this program, and it argues it *hence the agrs*
3) The code "System.out.println("My first program!");" means that when we compile the .java and run the .class it will display the text in the ("") and write it out.
Now that we have our code typed in we must save it as a .java file as so :
File > Save as... > save it as "first.java" without the ""s.
Now we want to move it to this directory:
C:\Program Files\Java\jdk1.6.0_VERSION#HERE\bin
Now that we have saved it to that directory.
Now what we do is go to:
Start > Run > cmd
and now we want to navigate to our JDK folder as so:
cd C:\Program Files\Java\jdk1.6.0_YOURVERSION#HERE\bin
Once we are here we want to execute this command in the CMD Prompt
it should look like that if you did it right, congratulations! you have made your first java program! WAIT! Don't close the CMD prompt yet, we have a tad bit more to do!
now we want to see the outcome of this long adventure?
right after you compile it type this command in:
and the out come should be:
And that's your first Java program ever!
More tutorials from me coming soon!
enjoy Rune Gear!
So first what you'll need is:
JDK(Java Development Kit)
That's about it o.o
Ok, so now let's start off by right-clicking on our desktop, and going to "New" and clicking "New Text Document"
Now name it "first" make sure the f is not capitalized.
Now, open that text document up and type this into it (Don't just C&P, you won't learn that way) and I will explain what the code means and does.
ALSO:for the first}'s DO NOT USE SPACES, USE THE TAB KEY!
Code:
/*
* First class for new java programmers
* Tutorial written by Javacisnotrecognized at runegear.net
* Enjoy :D
*/
class first {
public static void main(String[] args) {
System.out.println("My first program!"); // displays the text string
}
}
Now, let's break this down into the basics
1) What you see in the /* */ is what we call a "Block Comment" which means when we compile our .java file the compiler will ignore it and not include it in the compiled .class
2) The code "public static void main(String[] args) {" means that is the main code line for this program, and it argues it *hence the agrs*
3) The code "System.out.println("My first program!");" means that when we compile the .java and run the .class it will display the text in the ("") and write it out.
Now that we have our code typed in we must save it as a .java file as so :
File > Save as... > save it as "first.java" without the ""s.
Now we want to move it to this directory:
C:\Program Files\Java\jdk1.6.0_VERSION#HERE\bin
Now that we have saved it to that directory.
Now what we do is go to:
Start > Run > cmd
and now we want to navigate to our JDK folder as so:
cd C:\Program Files\Java\jdk1.6.0_YOURVERSION#HERE\bin
Once we are here we want to execute this command in the CMD Prompt
Code:
javac first.java
it should look like that if you did it right, congratulations! you have made your first java program! WAIT! Don't close the CMD prompt yet, we have a tad bit more to do!
now we want to see the outcome of this long adventure?
right after you compile it type this command in:
Code:
java first
and the out come should be:
And that's your first Java program ever!
More tutorials from me coming soon!
enjoy Rune Gear!