Jump to content
Banner by ~ Discord The Overlord

technology Introduction to Java...


Galen Selanno

Recommended Posts

Java is one of the world's most prevalent and widely-used programming languages. Unfortunately, it is also really hard to start immediately with the hard stuff. It requires some learning. Imma teach you the very basics. Starting... NOW!!!

 

Setup:

 

STEP 1!!!!!1!!!1!!11

 

Download Eclipse. Good downloads are here:

Eclipse Downloads

 

You also need the Java Development Kit. It can be found here:

JDK Downloads

 

STEP 2!!!!1!!1!!1!

 

Start up Eclipse once you have it downloaded. It should present you with a popup asking what workspace you'd like to use. Eclipse offers to make a new folder called 'workspace' for you. Just hit OK, because that's what you want it to do. When you arrive at the actual IDE (Integrated Development Environment), go to File > New > Java Project.

 

STEP 3!!!!!!!!

 

Once you have a new Java Project up, left click on the project's name in the Package Explorer. Go to New, and select 'Class'.

 

 

More updates later, guys! This should be enough to last you for about 15 minutes.

  • Brohoof 1

MLP. Home sweet home. I forgot how nice the residents of Equestria could be. Anyone seen The Martian?

         __       ____        ____                                             
 /'\_/`\/\ \     /\  _`\     /\  _`\                                           
/\      \ \ \    \ \ \L\ \   \ \ \L\_\___   _ __   __  __    ___ ___     ____  
\ \ \__\ \ \ \  __\ \ ,__/    \ \  _\/ __`\/\`'__\/\ \/\ \ /' __` __`\  /',__\ 
 \ \ \_/\ \ \ \L\ \\ \ \/      \ \ \/\ \L\ \ \ \/ \ \ \_\ \/\ \/\ \/\ \/\__, `\
  \ \_\\ \_\ \____/ \ \_\       \ \_\ \____/\ \_\  \ \____/\ \_\ \_\ \_\/\____/
   \/_/ \/_/\/___/   \/_/        \/_/\/___/  \/_/   \/___/  \/_/\/_/\/_/\/___/
Link to comment
Share on other sites

  • 2 weeks later...

Beginning Java: Start programming!

 

In your new class, you should see just these lines of code:

 

public class NewClass {

 

}

 

NewClass is just a name. You can make it any name you want in the New Class interface.

 

In between what we call "brackets" (i.e. { and }), type this code:

 

public static void main(String[] args) {

 

}

 

I'll explain the keywords (which show up in purple) later. What you just typed is called the main method. Your project won't run without it because the program starts execution at the main method. Luckily, each Java project (not to be confused with class) only requires 1 main method. Make sure you type in the main method in new Java projects first!

 

Ok. You should have a basic grasp of what to do first. Now, type this bit of code in in the main method:

 

System.out.println("Hello, world!");

 

Java is a case-sensitive language, which means that capitalization matters, so make sure you capitalize System!

 

Explanation: the class System provides a whole bunch of methods that you can use. out signifies output. println just tells the computer to output what it is told to and create a new line.

 

Well, done! You have created what is known as a Hello, World! program. These are used as beginner programs and are used to test a new programming language. If your code looks like this, you have completed it:

 

public class NewClass {

    public static void main(String[] args) {

        System.out.println("Hello, world!");

    }

}

 

To run it and make sure it works, look in the top bar of the Eclipse IDE. There should be a round green button with a white arrow inside it. Hit it, then look at the bottom of the IDE, at what is called the console (the console is used to store and show program output). It should say

 

Hello, world!

 

If it does, congratulations!

 

Alright. That should be good for now. See you guys soon!

 

P.S. I'd love your feedback! PM with any questions, complements, criticisms, or concerns.

Edited by TheAnonBrony
  • Brohoof 2

MLP. Home sweet home. I forgot how nice the residents of Equestria could be. Anyone seen The Martian?

         __       ____        ____                                             
 /'\_/`\/\ \     /\  _`\     /\  _`\                                           
/\      \ \ \    \ \ \L\ \   \ \ \L\_\___   _ __   __  __    ___ ___     ____  
\ \ \__\ \ \ \  __\ \ ,__/    \ \  _\/ __`\/\`'__\/\ \/\ \ /' __` __`\  /',__\ 
 \ \ \_/\ \ \ \L\ \\ \ \/      \ \ \/\ \L\ \ \ \/ \ \ \_\ \/\ \/\ \/\ \/\__, `\
  \ \_\\ \_\ \____/ \ \_\       \ \_\ \____/\ \_\  \ \____/\ \_\ \_\ \_\/\____/
   \/_/ \/_/\/___/   \/_/        \/_/\/___/  \/_/   \/___/  \/_/\/_/\/_/\/___/
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Join the herd!

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...