Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-11-2008, 04:47 AM   PM User | #1
BWiz
Regular Coder

 
BWiz's Avatar
 
Join Date: Mar 2006
Location: Sol System
Posts: 471
Thanks: 7
Thanked 21 Times in 21 Posts
BWiz is an unknown quantity at this point
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.

Code:
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!
2006
2007 2008 2009
2010 2011
Irrational numbers make no sense.
BWiz is offline   Reply With Quote
Old 09-11-2008, 04:17 PM   PM User | #2
brad211987
Regular Coder

 
brad211987's Avatar
 
Join Date: Sep 2005
Location: Ohio
Posts: 631
Thanks: 10
Thanked 50 Times in 50 Posts
brad211987 is an unknown quantity at this point
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.
brad211987 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:30 AM.


Advertisement
Log in to turn off these ads.