How to learn Java
DISCLAIMER
THIS TUTORIAL WILL NOT TEACH YOU EVERYTHING IN JAVA. I WOULD RECOMMEND (IF YOU REALLY WANT TO LEARN) BUY A BOOK OR WATCH THE NEW BOSTON'S TUTORIALS, OR ORACLE'S. THIS TUTORIAL IS NOT FINISHED.
Okay you want to learn Java huh?
Trust me it's not that hard.
Lesson one: Getting out of the water.
Section A: Hello MPGH:
Let's start, I'll give you some code and then I'll explain it:
Code:
public class Main { public static void main(String[] Args) { System.out.print("Hello MPGH!"); } }
How it works:
Code:
public
Code:
class
Code:
Main
Code:
public class <Your Class Name Here>
Code:
public static void main(String []Args)
He's checking it if it's counterfeit. And if your program doesn't have this then it won't run, like the airport guy won't let you pass.
What's the System.out thing?
Code:
System.out.print("Hello MPGH!");
You can change the text for what you want it to output. Make sure your text goes inside the " ".
Q: What are the curly braces for?
A: They determine sections of code. (Not the best explanation.
SECTION B: Variables:
In case you wondering this is how you do comments in java:
Code:
//This is a comment.
/* This is a comment */
Code:
public class Main { /* Public(I'm accessible to anyone!) class (Blueprint) Main(Name of Class) */ public static void main(String[] Args) /* That guy at the airport. */ { String MPGH = "Hello MPGH!"; /* Declaring a Variable that is a String. MPGH is Equal to the String (Or String of words) Hello MPGH! */ System.out.print(MPGH); /* Printing out the Variable MPGH which has the value "Hello MPGH!" */ } /* Ending the void */ } /* Ending the class */
Code:
int /* is an integer */
Code:
public class Main { /* Public(I'm accessible to anyone!) class (Blueprint) Main(Name of Class) */ public static void main(String[] Args) /* That guy at the airport. */ { String MPGH = "MPGH is ";/* Declaring a Variable that is a String. MPGH is Equal to the String (Or String of words) MPGH is */ int year = 12; System.out.print(MPGH + year); /* Printing out the Variable MPGH and adding the Variable year which is an int. This will result in MPGH is 12. */ } /* Ending the void */ } /* Ending the class */

i have a private server and i want to develop my skills and make my server cool