ok, im gonna try to make this as simple as i can, but java is easy so you will get it for sure!

Code: Select all
public class hey
{
public static void main(String args[])
{
}
}
public static void main(String args[]) is the way most programs are started, pretty easy so far i hope...
the brackets will need to be set up that way, and you put things between the MIDDLE brackets, unless you are adding a new method such as pause, but i wont explain that, because this is the basics.
congrats, you just learned how to and set up a program in java that does absolutally nothing!!!

Code: Select all
public class hey
{
public static void main(String args[])
{
System.out.println("hey");
}
}

start out with the same format, you can use hey.java if you want, but if you make a new file make sure its public clas followed by the name of the java file not including .java now in the middle prackets put
Code: Select all
int num = 6
Code: Select all
System.out.println(num);
Code: Select all
public class hey
{
public static void main(String args[])
{
int num = 6;
System.out.println(num);
}
}
Code: Select all
public class hey
{
public static void main(String args[])
{
String name = "The Amazing Stephen";
double decimal = 6.32154;
int num = 6;
System.out.println(name);
System.out.println(decimal);
System.out.println(num);
}
}
The Amazing Stephen
6.32154
6
as you can see int is for numbers with no decimals, double is for numbers with decimals, and String is for words and sentences. that is all the variables we will learn for now, because i dont want it to be too confusing. So last but not least... OPERATIONS WITH VARIABLES!!! im gonna give you the code to a program and i should look familiar for the most part, it will have a few minor discrepancies though, but i will explain them.
Code: Select all
public class hey
{
public static void main(String args[])
{
double abooga = 3.1415926535;
int iAmAwsome = 9;
double decimal = 6.32154;
int num = 6;
double total = 0;
total = abooga * iAmAwsome + decimal - num;
System.out.println(total);
}
}
28.595873881499998
so what is that jibberish about changing total from zero to 28.595873881499998? they are called variables for a reason, they can change!!! and what changed it was...
Code: Select all
total = abooga * iAmAwsome + decimal - num;
well thats all for now unless anyone wants more, have a good day

