tom b
05-06-2009, 01:01 AM
Hey im not really the best tutorial writer or the best person with grammar but i try my best ;)
--------------------------------------
Okay so to get started we need to go over a basic helloworld. Helloworld is a starting well an introduction to java ( Used in many other programming languages).
class Helloworld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
Okay so im going to break this down for you.
class Helloworld
{
This represents the name of the .class file
for e.g if the .class was meow it'd be class Meow {
-----
public static void main(String args[])
{
This is the java main method, you will come across this alot!
-----
System.out.println("Hello World!");
}
This command out prints the words Helloworld. like a send message in a server but diffrent.
----
Okay so now you have understood the Helloworld basic java app we can move on the putting this into action with new vocab.
Int - Int means interger it holds numeretic values. ONLY numbers! e.g int x = 1;
system.out.println("message"): - like a send message on a server but diffrent!
if ( - An if statement.
while ( - While statement
++ - Can be used with an int's value to stop loops.
----
So heres something i will explain using Java.
class Yourname//name of your .class
{
public static void main(String args[])//Java main method
{
int tom = 1;//interger! NUMBERS ONLY
if ( tom > 2 ) { // if tom is greater than 2 which it isnt (int)
system.out.println("Tom isn't bigger than 2.");// if toms bigger than to says that
}
}
}
(' // ' tells java to ignore the code thats in it )
there are also varios types of java comment blocks.
---
I don't really want to go into Java coding conventions maybe i will in my next tutorial.
---
Java questions!:
I felt like doing this as an add because many people ask theese questions!
What does a compiler do? - A compiled turns the .java into .class. .class are java byte codes ( What java reads to run the program)
why does a compiler get errors? - I know this is stupid but some bright sparks still confused with it. A compiler gets an error when you have programmed incorrectly causing the Javac ( The java compiler) to reture errors.
Why do i get 100 errors when i edit .class files - Because .class files are java byte codes and if you edited them the compiler can't compile the things that have alredy been compiled + the java byte codes are like juberish so trying to add some java in there is quite pointless.
------
So yeh im sorry for any bad grammar and ile look forward to my next tut.
- Tom
--------------------------------------
Okay so to get started we need to go over a basic helloworld. Helloworld is a starting well an introduction to java ( Used in many other programming languages).
class Helloworld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
Okay so im going to break this down for you.
class Helloworld
{
This represents the name of the .class file
for e.g if the .class was meow it'd be class Meow {
-----
public static void main(String args[])
{
This is the java main method, you will come across this alot!
-----
System.out.println("Hello World!");
}
This command out prints the words Helloworld. like a send message in a server but diffrent.
----
Okay so now you have understood the Helloworld basic java app we can move on the putting this into action with new vocab.
Int - Int means interger it holds numeretic values. ONLY numbers! e.g int x = 1;
system.out.println("message"): - like a send message on a server but diffrent!
if ( - An if statement.
while ( - While statement
++ - Can be used with an int's value to stop loops.
----
So heres something i will explain using Java.
class Yourname//name of your .class
{
public static void main(String args[])//Java main method
{
int tom = 1;//interger! NUMBERS ONLY
if ( tom > 2 ) { // if tom is greater than 2 which it isnt (int)
system.out.println("Tom isn't bigger than 2.");// if toms bigger than to says that
}
}
}
(' // ' tells java to ignore the code thats in it )
there are also varios types of java comment blocks.
---
I don't really want to go into Java coding conventions maybe i will in my next tutorial.
---
Java questions!:
I felt like doing this as an add because many people ask theese questions!
What does a compiler do? - A compiled turns the .java into .class. .class are java byte codes ( What java reads to run the program)
why does a compiler get errors? - I know this is stupid but some bright sparks still confused with it. A compiler gets an error when you have programmed incorrectly causing the Javac ( The java compiler) to reture errors.
Why do i get 100 errors when i edit .class files - Because .class files are java byte codes and if you edited them the compiler can't compile the things that have alredy been compiled + the java byte codes are like juberish so trying to add some java in there is quite pointless.
------
So yeh im sorry for any bad grammar and ile look forward to my next tut.
- Tom