Share on Google+Share on Google+

wasim akram
static keyword
1 Answer(s)      5 years and 9 months ago
Posted in : Java Beginners

please give some detail about Static keyword.


View Answers

June 29, 2011 at 10:30 AM

Static Variables

Static variables are class variables that are shared by all instance of class ..

1)It is a variable which belongs to the class and not to object(instance).

2)Static variables are initialized only once , at the start of the execution . These variables will be initialized first, before the initialization of any instance variables.

3)A single copy to be shared by all instances of the class.

4)A static variable can be accessed directly by the class name and doesn√Ę‚?¨‚?Ęt need any object.

Static Methods

Static method is the method which belongs to the class and not to the object(instance).

1)A static method can access only static data. It can not access non-static data (instance variables).

2)A static method can call only other static methods and can not call a non-static method from it.

3)A static method can be accessed directly by the class name and doesn√Ę‚?¨‚?Ęt need any object.

4)A static method cannot refer to "this" or "super" keywords in anyway.

Related Tutorials/Questions & Answers:
static keyword
static keyword  please give some detail about Static keyword.   Static Variables Static variables are class variables that are shared... and not to object(instance). 2)Static variables are initialized only once , at the start
static keyword
static keyword  Hii, In which portion of memory static variables stored in java. Is it take memory at compile time? thanks deepak mishra
static keyword with real example
static keyword with real example  static keyword with real examplestrong text
why using static keyword
why using static keyword  why using static keyword
static keyword in interface
static keyword in interface  Could any one explain,why static keyword implict (or explict ) come in interface? I asked lot of persons about this question, but nobody did not answered clearly. please explain clearly and say what
Static keyword in public static void main
Static keyword in public static void main  Hi, I have seen that on page mentioned below for static keyword explanation given is: Page: http...: static keyword indicates that this method can be invoked simply by using the name
static Java Keyword
static Java Keyword       The static is a keyword defined in the java programming language. Keywords... in java programming language likewise the static keyword indicates the following
static keyword in java
.style1 { color: #0000FF; } static keyword in java We are going to discuss about static keyword in java. The static keyword is a special keyword in java programming language. A static member belongs to a class
making consistency of data member in the whole programme without using static keyword
making consistency of data member in the whole programme without using static keyword  In the below programme i use one boolean variable named check... use static but i want to know some alternative way ..could anyone give me some
instances of the class. When static is applied to methods, the static keyword...static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory
STATIC  WHAT IS STATIC BLOCK?EXPLAIN , AND WHAT IS THE DIFFERENCE BETWEEN STATIC BLOCK AND STATIC METHOD?   A STATIC block is automatically... between static block and static method: static block will execute when ever
Static Concept  in what are all the situation we may use static...,then use static blocks and without creation of object we need to perform some task,then go for static methods. If we want variables those values will not be changed
static  What is the exact need of declaring a variable as static?   A static variable is a variable who's single copy in memory is shared by all objects,so any modifications to the static variable will modify it's value
Static  Can i know the real time example for Static method and final variables with defenition? Thank you
redeclare static variable in the inherited class  can we redeclare static variable in the inherited class like this: public class StaticClass1 { class StaticClass1{ static int noOfInstances; StaticClass1
Static variable in java
Static variable in java. Static is a keyword in java used to create static methods, variable inside a class and static class. Static variable is also called class variable which belongs to class not to object. Static
Keyword - this
Keyword - this       A keyword is a word having a particular meaning to the programming language. Similarly, this keyword is used to represent an object constructed from a class
What is this keyword?
What is this keyword?  What is this keyword
PHP Static Variable and Methods
PHP Static Methods and Variables: In this tutorial we will study when we should use static methods and variables. Static keyword is used to make only one... of that attribute. Static data are used when some data has to share within
Return keyword
of return keyword import java.util.*; public class ReverseString{ public static String reverse(String st){ String rev = new StringBuffer(st).reverse().toString(); return rev; } public static void main(String
The if Keyword
The if Keyword         The if is a keyword, which is used to perform the selection... that are executed in case, the test condition specified by the if keyword evaluates
Java keyword
Java keyword  Is sizeof a keyword
Static Variable
. When static is applied to methods, the static keyword means that the specified...Static Variable  What is the basic use of introducing static variable type in java?Please explain clearly....   The Static means
super keyword
super keyword  super keyword explain
The for Keyword
The for Keyword       The for is Java keyword that is used to execute a block of code... statement increments the value of i by one. The for keyword may not be used
final keyword
final keyword  why is final keyword used in java
transient keyword
transient keyword  how to use transient keyword?   Hi Friend, The transient keyword is used to indicate that the member variable should not be serialized when the class instance containing that transient variable
The final Keyword
The final Keyword       The final is a keyword. This is similar to const keyword in other languages. This keyword may not be used as identifiers i.e. you cannot declare
Dynamic keyword
Dynamic keyword  hi....... What is the dynamic keyword used for in flex? give me the answer ASAP Thanks  Ans: Dynamic keyword... during the run-time. Just add the magic keyword dynamic to the class definition
static in java
static in java  what is the need to go static? what use
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code


Advertisement null