Please note that this will have pics soon its just ubuntu is a pain in the ass to take screenies. I may make a few video tuts if asked.
Part 1 \n Installing the jsdk.
Note if anything sounds unclear look up "The new bostons" tuts on youtube.
Download "JDK 6 Update 17" (The 17 part doesn't matter) from here.
Set that up on your OS. (Note if using ubuntu or a debian based linux dist just look up Sun sdk in synapic.)
After that you should setup a ide sense it gives you useful debugging tools and such.
I suggest eclipse which can be found here.
After you have your workspace setup and everything it is time to get on to the real tut.
Results 1 to 6 of 6
Thread: Java tuts
- 23 Nov. 2009 01:14am #1
Java tuts
Last edited by God; 23 Nov. 2009 at 01:38am.
Most likely the person above and below me is a weaboo.
Oh yeah and I program so if need anything just request it and I might get around to it.
- 23 Nov. 2009 01:15am #2Part 2
Looking at hellrld.
Here is out basic hellrld script.
Code:class nexx { public static void main(String[] args) { System.out.println("Hello World!"); } }
Lets look at it line by line.
Heres the first line.
Code:class nexx {
Heres our second line.
Code:public static void main(String[] args) {
Heres out third line where all the magic happens.
Code:System.out.println("Hello World!");
and the closing brackets for the opening brackets. (Note: You always must have the same amount of opening brackets as you do closing.)
Now lets get to executing this program. Open up that eclipse program that you set up earlier and just click next and use the defaults for all settings.
Make a new project using file-new-java project and call it whatever and make a new class with file new class and call it "nexx" and leave the rest default.
Copy and paste all of the script that is up there into the main box and click the green play button. If asked press "Java application". Then in the box below you should see "Hello World!".
Congrats you have just made your first java program.Last edited by God; 23 Nov. 2009 at 01:39am.
Most likely the person above and below me is a weaboo.
Oh yeah and I program so if need anything just request it and I might get around to it.
- 23 Nov. 2009 01:15am #3Part 3
Variables
Now we are going to take a look at variables in java.
Here are some basic types.
String
int
There are many more kinds but for now lets stick with those to make it simple.
The first is a String. A String holds letters and numbers and such. Your going to not use this for just numbers due to speed and other issues which you will learn about in a while.
A String might look like this.
Code:String test = "I am a string";
Now for a int.
A int holds a whole number like 1 or 2 but not 1.4535697878469385936.
A int cannot hold any letters.
Example of a int.
int lulwut = 18;
Now you know a little bit about ints and strings, Lets put them to use.
Take your hellrld script from the last part and change a few things up.
Before ourCode:System.out.println("Hello World!");
Code:String stringtest = "This a is string.";
Code:int inttest = 187;
Code:class nexx { public static void main(String[] args) { String stringtest = "This is a string"; int inttest = 187; System.out.println("Hello World!"); } }
To do this we are going to modify our System.out line.
Lets edit our line toCode:System.out.println("This is my string " + stringtest + " This is my int " + inttest);
If we exucute this we should getCode:This is my string This is a string This is my int 187
Well this is about it on vars for now.Last edited by God; 23 Nov. 2009 at 02:00am.
Most likely the person above and below me is a weaboo.
Oh yeah and I program so if need anything just request it and I might get around to it.
- 23 Nov. 2009 01:15am #4
Arghh Im tired.
Last edited by God; 23 Nov. 2009 at 02:00am.
Most likely the person above and below me is a weaboo.
Oh yeah and I program so if need anything just request it and I might get around to it.
- 28 Nov. 2009 07:26am #5
nice tut very helpful
- 28 Nov. 2009 07:44am #6