Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
static Java Keyword  
 

The static is a keyword defined in the java programming language.

 

static Java Keyword

                         

The static is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java programming language likewise the static keyword indicates the following : 

 -- The static keyword is applicable to an inner class (a class defined within another class), method or field. 

--  In java language, a static keyword is used with a class (inner) needed to be instantiated, even this may be referenced by some other class indicating as if it - were a top−level class in the class hierarchy.

The example shown below shows how to use static keyword with a class:

public class Class1{

static class Class2;

}

-- A static keyword can also be used with a  field of a class, such a field exists across all the instances of that particular class. 
-- the syntax shown below is used to declare the class constants required to be used from outside the class.

public final static <type> varName = <value>;


Example to use the static keyword with a variable and with a constant:

public class Class1

{

public final static int MAX_OBJECTS = 100;

static int x = 0;

}


-- A static method is invoked even from outside the class without requiring to create the instants of that particular class. We all aware of the use of the " public static void main method()" in most of the console base programming environments.

Example to use the static keyword with a method:

public class Class1{

static int getObjects(){

}
public static void main method(String av[]){

<statements>
<statements>

...

<statements>
}
}

                         

» View all related tutorials
Related Tags:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

me as a fresher student for i want to search the complete program but it is not complete

Posted by Niranjan on Friday, 07.10.09 @ 09:25am | #89215

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.