Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Sol System
    Thanked 21 Times in 21 Posts

    Syntax Definitions

    I've been doing a couple of Java tutorials that I've found online, however none of them seem to sufficiently explain some of the syntax that I am using. I don't really want to leave a hole in my knowledge, so I was wondering if someone could explain what some of these keywords (not sure of what term to use when referring to them) mean.

    public class HelloWorld {
        public static void main (String[] args) {
            System.out.println("Hello, World!");
    If somebody could explain what all the highlighted words mean, I would appreciate it greatly. Also, any in depth tutorials for beginners would be good too. Thanks in advice.
    BWiz :: Happy Coding!
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.

  2. #2
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Thanked 50 Times in 50 Posts
    public: This is an access keyword used to define what type of access other objects have to your class and its methods. public will let any objects create an instance of your class and use its public methods. There is also Private that restricts access to the current class, and Protected which restricts access to classes in the same package as your class.

    static: This defines class attributes/methods/variable. In simple terms, this means that there is only one main method across all of the instances of your class.

    void: This is the return type for the method. Void means that the method does not return anything.

    {String[] args}: This is the argument list for the main method. The main method takes a String Array(String[]) of arguments, and "args" is the variable that references that array.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts