Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners static functions
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Praveen Kumar
static functions
11 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


Give some brief defenition for
1. Static Variables
2. Static Functions
3. Instance Variable


Advertisement
View Answers

June 24, 2011 at 3:44 PM


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.

Instance Variables

An instance variable is a variable which is related to a single instance of a class. Each time an instance of a class is created, the system creates one copy of the instance variables related to that class.An instance variable is declared inside a class, but not within a method.

For more information, visit the following links:

Java Static Variables

Java Instance Variables

Java Static Method



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



September 24, 2011 at 2:16 PM


class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name

} }



Related Tutorials/Questions & Answers:
static functions
static functions  Give some brief defenition for 1. Static Variables 2. Static Functions 3. Instance Variable  Static Variables Static...)It is a variable which belongs to the class and not to object(instance). 2)Static
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
Advertisements
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  what r the main uses of static in java   Hi Friend, 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
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  Can i know the real time example for Static method and final variables with defenition? Thank you
static
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
What is functions?
What is functions?  Hi, Please tell me about PHP functions? Thanks in advance
What is functions?
What is functions?  Hi, Please tell me about PHP functions? Thanks in advance
What is functions?
What is functions?  Hi, Please tell me about PHP functions? Thanks in advance.   About Functions: Functions in PHP is block of code... functions and use it multiple times. In PHP there is many pre-defined functions
Inbuild functions
Inbuild functions  List all the inbuild functions in java
Functions and Methods
Functions and Methods  Write a Java program to input the sides... { public static void decide(int side1,int side2,int side3){ String..."; System.out.println(type); } public static void main(String[] args
static in java
static in java  what is the need to go static? what use
Static method
Static method  what is a static method?   Have a look at the following link: Java Static Method
static method
static method  Give some absolute examples and definition for static method also
static methods
static methods  why static methods cannot read or write the instance variables
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 Variable
Static Variable  What is the basic use of introducing static variable type in java?Please explain clearly....   The Static means... of a class, an object, is created. When static is applied to member variables
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
Static       Static... an instance of a class. Static methods are implicitly final method, since overriding depends on the type of the object, and static methods are attached to a class
Functions and Methods
Functions and Methods  (1) Write a program in java to input 10... static void findCube(int num[]){ for(int i=0;i<num.length;i...])); } } public static void main(String args[]){ Scanner input=new
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
STRING FUNCTIONS
the following code: import java.util.*; class StringExample{ public static...) ); return buf.toString(); } public static void main(String[] args
PHP Functions, PHP Functions Tutorials
PHP Functions In this section we will understand important PHP functions with the help of example code. What is Functions? Function is a block of code...; } Functions in PHP PHP provides many built-in functions to do the real job
How to Use Java Functions In EL
How to Use Java Functions In EL          To use a Java Functions in  EL we need three things. The java class with a static method. A Tag Library
the functions unlink and unset
the functions unlink and unset  What is the difference between the functions unlink and unset
functions strstr() and stristr().
functions strstr() and stristr().  What is the functionality of the functions strstr() and stristr
decodeURI() and encodeURI() functions in JavaScript
decodeURI() and encodeURI() functions in JavaScript  What are decodeURI() and encodeURI() functions in JavaScript
What are encryption functions in PHP?
What are encryption functions in PHP?  What are encryption functions in PHP
Boolean functions in JavaScript
Boolean functions in JavaScript  Explain about the Boolean functions present in Javascript
 

 

 

DMCA.com