Home Answers Viewqa Java-Beginners Static Variable

 
 


Sharath Kumar
Static Variable
1 Answer(s)      a year and 5 months ago
Posted in : Java Beginners

What is the basic use of introducing static variable type in java?Please explain clearly....

View Answers

January 11, 2012 at 2:51 PM


The Static means that a certain object/variable is resident in memory and accessed each time an instance of a class, an object, is created.

When static is applied to member variables, it means that the static variable is shared among all instances of the class.

When static is applied to methods, the static keyword means that the specified method of the object can be accessed directly, without the need for an instance of that object.

For more information, visit the following link:

http://www.roseindia.net/help/java/s/static-java-keyword.shtml









Related Pages:
Static Variable
Static Variable  What is the basic use of introducing static variable type in java?Please explain clearly....   The Static means..., it means that the static variable is shared among all instances of the class
static
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
static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory... is applied to member variables, it means that the static variable is shared among all
static
redeclare static variable in the inherited class  can we redeclare static variable in the inherited class like this: public class StaticClass1...); **//here i have redeclared the static variable as "25" is it possible,then what
static variable in php
static variable in php  How can i call a global variable as a static variable
how to inherit static variable
how to inherit static variable   how to inherit static variable or methods in Java?? Please explain the entire process of inheriting the variable. Thanks in advance
STATIC VARIABLE DECLARATION
STATIC VARIABLE DECLARATION  why cannot the static variable declare inside the method
What is the importance of static variable?
What is the importance of static variable?  hi, What is the importance of static variable? thanks
Serialize the static variable
Serialize the static variable  hello, Can we serialize the static variable?   hii Yes we can serialize the static variable. if u don't want to serialize, u need to declare the variable as transient
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
Can we declare a static variable inside a method?
Can we declare a static variable inside a method?   Hi, Can we declare a static variable inside a method? thanks
non static variable cannot be referenced from static context
non static variable cannot be referenced from static context  public... "non static variable cannot be referenced from static context". How to solve... public static void main(String []s){ Add a1=new Add(); a1.add(7,8
non static variable cannot be referenced from static context
non static variable cannot be referenced from static context  public class Add{ int foo=7; int bar=8; public int add(int x,int y... public static void main(String []s){ Add a1=new Add(); a1.add(7,8
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 copy of the variable for the class. All objects of that class will access one copy
Java static method example
Description: Static variable are used within the static method. Non static variable do not exits in the static method. Static variables are shared by its class instances. Static variable can be used without using the instances
Example of a class variable (static variable)
Example of a class variable (static variable)   ... you can define the static class variable in a class. When a number of objects... of a static variable first of all create a class StaticVariable. Define one static
static functions
)It is a variable which belongs to the class and not to object(instance). 2)Static...)A single copy to be shared by all instances of the class. 4)A static variable can...static functions  Give some brief defenition for 1. Static Variables
static keyword
instances of the class. 4)A static variable can be accessed directly by the class name...static keyword  please give some detail about Static keyword.   Static Variables Static variables are class variables that are shared
Static keyword in public static void main
example for this?   The static variable is declared by using static...; The variable declared with static keyword is called class variable. This variable is shared by all the instances of the class. The static variable can be accessed
private static final
private static final  Why there is necessary to make a variable private static final
static keyword in java
method, static variable. A static keyword points the following: static methods. static variable.  static methods:- static method are unique... of static method:- <class-name>.<method-name> static variable
PHP Variables Static
PHP Variables Static PHP static variable is used to remember the value... is running a static variable is only retained by the function , but it is NOT shared.... If you noticed, we mentioned static statement before the $text variable within
Static Method in PHP - PHP
Static Method in PHP  So far I can easily use the normal functions as variable in PHP? but how can use static method?  Hi Friend, Please...-static-variable-method.html Thanks
static & instance - Java Beginners
static & instance  what is different between static variable and instance variable .? plz explain with example. and when we can use static variable and when can use instance variable.    public class Main
static object array
static object array  static object array   Dynamically call a static variable array class Blog { public static $template = array('content' => 'doodle'); } Blog::$template['content'] = 'bubble'; $class = 'Blog
Example of a instance variable
variable in a main method. If we try to call the non-static method in the main method then the compiler will prompt you that non-static variable cannot be referenced from a static context. We can call the non-static variable by the instance
Variable Names
Java Notes Variable Names Basic variable naming conventions Choosing good names is probably..., these variable naming conventions are almost always used. Here is what
STATIC
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
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
Static  Can i know the real time example for Static method and final variables with defenition? Thank you
Static final variables - Java Beginners
Static final variables  can a static final variable be accessed by a instance (non-static)method?  Hi, static final variable u can access in non-static method. but the variable should has accessibility, means
Declare Reference variable
variable static int b; // static variable A ref; static A refs; public static void main(String[] args) { // statements... in memory when object is created. Static variable is class variable which
What is a transient variable?
What is a transient variable?   Hi, What is a transient variable? Thanks,   Hi, Any variable which is altered(modified) with transient keyword becomes transient variable in java. It will be beneficiary
Store Variable in Java
Store Variable in Java  How to store Variables in Java?   public class DoubleTest { public static void main(String[] args) { double...(aDouble); // Outputs 7.21 } }   Variable in Java
about static import - Java Beginners
about static import  Hello Friend below program is not running when... i compile B.class it is showing the compile time error on variable i. i want to ask that "static import" syntax is correct or not package mypackage1
Example of static method
an instance of the class. If you try to use a non-static method and variable defined in this class then the compiler will say that non-static variable or method... variable and other is class variable. Make one static method named staticMethod
static Java Keyword
;; Example to use the static keyword with a variable and with a constant... static Java Keyword       The static is a keyword defined in the java programming language. Keywords
Instance variable in java
/static variable Instance variable : Instance variable are declared...Instance variable in java In this section you will learn about Instance variable in java. In java all variable must be declared before they are used
Initializing Integer Variable issue?
Initializing Integer Variable issue?  My program is supposed to take a phrase like you'd see on a TV commercial, for example: "Call 1-800-GETLOAN now... Chapter5Problem5 { public static void main(String[] args) { String inputPhrase
Sending query with variable - JSP-Servlet
. The links page is not static one. Links page displays the contents from database and query should have a variable at the end. While using this variable we... page. How can we resolve this. Static page link: But in case of static
Local Variable ,Package & import
Variable public class LocalVar { public static void main(String args... the Class Variable public class ClassVar { private static int...Local Variable ,Package & import A local variable has a local scope.Such
store data from a variable in mysql?
store data from a variable in mysql?  sir last time asked you tell me how to retrieve data from a database mysql and store it in an int variable... of the calculation from an int variable into mysql in a new table of database. how
Get Environment Variable Java
Get Environment Variable Java       In this example we are getting environment variable. To get the environment variable we use getenv() method. Map is an interface
PHP Variable Scope
; is static variable,  the scope of a static variable exists only in a local...PHP Variable Scope: In every language every variable has a scope, may... of a variable in PHP is inside a function or inside a block. To make the variable global
Using Unicode Variable Names - Java Tutorials
Using Unicode Variable Names 2001-11-23 The Java Specialists' Newsletter [Issue 036] - Using Unicode Variable Names Author: Dr. Heinz M. Kabutz... members are currently subscribed from 56 countries Using Unicode Variable
Java Transient Variable
Java Transient Variables Before knowing the transient variable you should firs... mark that object as persistent. You can also say that the transient variable is a variable whose state does not  Serialized. An example of transient
help regarding variable types and its modifiers
help regarding variable types and its modifiers  static variable is initialized once only and can be used by all objects. i want static in sense... by user. is it possible to declare a variable as counter which will increment each
how to pass class variable to another class
how to pass class variable to another class  i need to access a variable from a class to another class currently running at the same time. using... the previous value. I used static variabe.   Hi Friend, Try
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir... to store that data in int variable. how to do this ?   Here is an example... the database. import java.sql.*; class RetrieveData { public static void main