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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Praveen Kumar
Static
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners


Can i know the real time example for Static method and final variables with defenition? Thank you!


Advertisement
View Answers

June 24, 2011 at 4:53 PM


Static Method

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.

Final Variables:

Final variables are the variables that cannot be modified. They are constants. They should be initialized either when they are defined or in constructor. Once initialized their value cannot be changed.

For more information, visit the following link:

Static Methods]

Final Keyword



Related Tutorials/Questions & Answers:
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
Advertisements
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
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 methods
static methods  why static methods cannot read or write the instance variables
static method
static method  Give some absolute examples and definition for static method also
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 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
demonstrate a) static data members b) static methods
demonstrate a) static data members b) static methods  demonstrate a) static data members b) static methods
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
About Static Class
About Static Class  is it neccessary to create object for static class
why using static keyword
why using static keyword  why using static keyword
Java static method
Java static method  Can we override static methods
Java static import
Java static import  What is the use of static import
static keyword with real example
static keyword with real example  static keyword with real examplestrong text
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
Can a class be declared as static?
Can a class be declared as static?  Hi, Can a class be declared as static? thanks
What is the importance of static variable?
What is the importance of static variable?  hi, What is the importance of static variable? thanks
static page and dynamic pages?
static page and dynamic pages?  what is the static page and dynamic pages
static page and dynamic pages?
static page and dynamic pages?  what is the diff between static page and dynamic pages
static page and dynamic pages?
static page and dynamic pages?  what is the static page and dynamic pages adv and disadv
Static & Instance variables in java
Static & Instance variables in java  What are the Difference between Static & Instance variables in java
Static Method in Java
Static Method in Java  Is Overriding Static methods possible in java? If Yes, How
Advertisements
 

 

 

DMCA.com