Simple Java Guide for New Learners

Discussion in 'Archives' started by Jokerz, May 28, 2008.

Simple Java Guide for New Learners
  1. Unread #1 - May 28, 2008 at 2:57 AM
  2. Jokerz
    Joined:
    Apr 24, 2008
    Posts:
    610
    Referrals:
    0
    Sythe Gold:
    0

    Jokerz Forum Addict

    Simple Java Guide for New Learners

    Hey folks. I'll give you a simple Java guide to see if you are interested in Java, I myself is learning Java slowly ;)

    What you need:

    - JDK 6 (Download Here: http://java.sun.com/javase/downloads/index.jsp)
    - Command Prompt
    - Notepad
    - A Brain
    - A keyboard

    Shall we start?

    I've decided to add a block comment at the start of the program, It will help people know what the program is.

    A block comment looks like this.

    Code:
    /* Hello Rawr, by Vinny
               *
              /*
    
    That line will be ignored by the Java compiler (Javac)

    Next we shall identify the class we want to make. So open up Notepad and type this in.

    Code:
    class HelloRawr {
    As you can see we are calling the class to be HelloRawr, When we compile this later it will make it HelloSythe.

    Under it you may put this.

    Code:
    //This is a single line comment. etc...
    This is the same as block comment but for just one line only.

    Now time for the main coding.

    Under the single line comment put:

    Code:
    public static void main(String args[]){
    Woah! What was that?

    Let me explain in small parts.

    • Public: This means its going to be a public class its public
      Static: This allows main() to happen. Which is shown here as (String args[])
      void: This will not return any values we set.
      main: This is calling main (used for javac)
      String: This is a readable language by humans.
      args: Calling an argument forth
      []: Random
      {: Clossing the function
    Now under that code add this:

    Code:
    System.out.println("Hello Sythe");
    This code will tell the program to print some words in the bracket. (Use if you want to print word).

    Your final code should look like this.

    Code:
    /* Hello Rawr
               *
              /*
                  class HelloRawr {
               //Random comment lol
              public static void main(String args[]) {
              System.out.println("Hello Rawr");
            {
          {
    Time to compile this bitch.

    Save the file as HelloRawr.java in C:\Java

    Now open Command Prompt and type in this.

    cd C:\Java

    (This changes the Directory to C:\Java)

    Now type this: javac HelloRawr.java

    Now check the Java file and there should be HelloRawr.class

    Now open it and it should display 'Hello Rawr'

    Congrats, You have learnt the first step to Java.
     
  3. Unread #2 - May 28, 2008 at 4:04 AM
  4. Crayola Oblongata
    Joined:
    Feb 27, 2008
    Posts:
    2,247
    Referrals:
    4
    Sythe Gold:
    0

    Crayola Oblongata Grand Master
    Banned

    Simple Java Guide for New Learners

    Nice and simple! Youve got me interested in java now but I wasnt before reading
     
  5. Unread #3 - Jun 10, 2008 at 10:39 PM
  6. Scrubs
    Joined:
    Mar 4, 2008
    Posts:
    68
    Referrals:
    0
    Sythe Gold:
    0

    Scrubs Member

    Simple Java Guide for New Learners

    Nice and simple, HelloWorld->HelloSythe :p
     
  7. Unread #4 - Jun 29, 2008 at 3:12 PM
  8. david123
    Joined:
    Jan 3, 2008
    Posts:
    1,021
    Referrals:
    0
    Sythe Gold:
    0

    david123 Guru

    Simple Java Guide for New Learners

    very nice guide.. i've never really knew how to code with java but now i know some basics :) thanks
     
  9. Unread #5 - Jun 29, 2008 at 7:32 PM
  10. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,211
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    Simple Java Guide for New Learners

    Nothing is explained very well. If people had no idea what Java was, they would still be lost.

    main is java's main method, the method that is run when you start the program

    Public: Public method
    Static: Makes it so you do not need to create an object from the method before using... ( or sumthing likr that)
    void: This will not return any values we set.
    main: what javas main method is called
    String: a group of letters... Like this... :/
    args: advanced shit, you won't use for awhile.. to lazy to tell you
    []: it means it an array
    {: starting the method... :/

    } end of method. :/
     
  11. Unread #6 - Aug 8, 2008 at 5:21 PM
  12. Benz
    Joined:
    Apr 30, 2007
    Posts:
    255
    Referrals:
    0
    Sythe Gold:
    0

    Benz Forum Addict

    Simple Java Guide for New Learners


    Sigh..

    Public isn't a method, it's an access level. It allows it to be inherited, while protected can't be overriden, and private cannot be inherited.

    A void is a method that won't return any values (you got most of that right).

    A string isn't just a group of letters. A string can be a single word, a group of phrases, a group of letters, or a group of numbers. All strings are in between quotation marks.

    Args is short for argument.
     
  13. Unread #7 - Aug 12, 2008 at 7:14 AM
  14. idkaboutthis
    Joined:
    Jan 29, 2007
    Posts:
    1,164
    Referrals:
    0
    Sythe Gold:
    0

    idkaboutthis Guru
    Banned

    Simple Java Guide for New Learners

    this clears my problem up with what "static " does.
    i can do public static void can i?
     
  15. Unread #8 - Aug 30, 2008 at 3:19 PM
  16. joking
    Joined:
    Nov 9, 2007
    Posts:
    736
    Referrals:
    3
    Sythe Gold:
    0

    joking Apprentice
    Do Not Trade

    Simple Java Guide for New Learners

    well put together thx
     
  17. Unread #9 - Sep 4, 2008 at 4:24 PM
  18. Jadla
    Joined:
    Sep 3, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Jadla Member

    Simple Java Guide for New Learners

    you should include class structures, what IDE do you recommend for java?
     
  19. Unread #10 - Sep 11, 2008 at 6:59 AM
  20. mr.bloodS
    Joined:
    Sep 10, 2008
    Posts:
    149
    Referrals:
    0
    Sythe Gold:
    0

    mr.bloodS Active Member
    Banned

    Simple Java Guide for New Learners

    Quite intresting, i always wanted to lern java but i just don't have the time.
     
  21. Unread #11 - Sep 11, 2008 at 7:21 PM
  22. john dean
    Joined:
    Sep 1, 2008
    Posts:
    514
    Referrals:
    0
    Sythe Gold:
    0

    john dean Forum Addict
    Banned

    Simple Java Guide for New Learners

    to complicated for me, maybe ill try in 2 years lol :)
     
  23. Unread #12 - Sep 11, 2008 at 11:19 PM
  24. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    Simple Java Guide for New Learners

    Sadly compiling this fails because a multi-line comment is meant to be closed with "*/" and not "/*"
    This will not work for the MAJORITY of people because the average user won't have the Java environment variables setup and therefore will have to specify the exact path to "javac" for Windows to find it (C:\Program Files\Java\Jdk[...]\bin\javac).
    The public modifier allows for something to be accessed throughout the program.
    The static modifier allows for members/methods to be invoked without creating any objects.
    Void means that something will not return a value PERIOD.
    The main function of a java program is called as soon as you run the program. Without one a java program isn't executable.
    Strings are objects defined by the String class in Java that can hold a sequence of characters by putting double quotes around some text.
    Args (short for arguments) are string values you can pass to your program when you first execute to add aditional functionality or specify a certain way you want it to run.

    From your compile errors and such basic compiling instructions it's obvious you aren't very far into the language at all, let alone ready to write a guide to teach others how to start off. Something like this can only give others bad notions/habits in regards to the language and programming itself or put them off it completely when they notice it doesn't work as planned. In the future stick to what you do know, when it comes to writing guides.
     
  25. Unread #13 - Oct 22, 2008 at 1:13 PM
  26. st33l3rs fan
    Joined:
    Jul 20, 2008
    Posts:
    338
    Referrals:
    0
    Sythe Gold:
    0

    st33l3rs fan Forum Addict
    Banned

    Simple Java Guide for New Learners

    wow, i was thinking about getting into java...but im in over my head, thanks anyway :p
     
  27. Unread #14 - Nov 1, 2008 at 7:25 PM
  28. Account_Merchant11
    Referrals:
    0

    Account_Merchant11 Guest

    Simple Java Guide for New Learners

    Nice!
     
  29. Unread #15 - Nov 1, 2008 at 7:25 PM
  30. Account_Merchant11
    Referrals:
    0

    Account_Merchant11 Guest

    Simple Java Guide for New Learners

    uhm thats cool :)
     
  31. Unread #16 - Nov 3, 2008 at 4:10 PM
  32. Noob!
    Joined:
    Aug 29, 2008
    Posts:
    322
    Referrals:
    0
    Sythe Gold:
    0

    Noob! Forum Addict
    Banned

    Simple Java Guide for New Learners

    i wana get into java..
     
  33. Unread #17 - Dec 3, 2008 at 9:51 AM
  34. EnlightenMe
    Joined:
    Jun 18, 2008
    Posts:
    877
    Referrals:
    1
    Sythe Gold:
    0

    EnlightenMe The Swimmer
    Banned

    Simple Java Guide for New Learners

    nice guide, help me to start with basics. thanks
     
  35. Unread #18 - Dec 3, 2008 at 9:54 AM
  36. Lunamewtwo
    Joined:
    Jul 30, 2008
    Posts:
    366
    Referrals:
    0
    Sythe Gold:
    0

    Lunamewtwo Forum Addict
    Banned

    Simple Java Guide for New Learners

    Good Guide for idiots who keep posting asking for help. Two thumbs up:)
     
  37. Unread #19 - Dec 11, 2008 at 10:26 AM
  38. war833
    Joined:
    Dec 11, 2008
    Posts:
    82
    Referrals:
    0
    Sythe Gold:
    0

    war833 Member

    Simple Java Guide for New Learners

    Most of this stuff is wrong, please learn more before you attemp to make a tutorial. It is misleading to people trying to learn java...
     
  39. Unread #20 - Dec 12, 2008 at 12:20 AM
  40. gamerz_grimm
    Joined:
    Oct 31, 2008
    Posts:
    601
    Referrals:
    1
    Sythe Gold:
    0

    gamerz_grimm Forum Addict
    Banned

    Simple Java Guide for New Learners

    i mite get into java coding, my friend does it and i learned a little c++ but ive heard java is way easier
     
< New site Check it out | buying windows xp restore cd >

Users viewing this thread
1 guest


 
 
Adblock breaks this site