Static Concept

Static Concept

in what are all the situation we may use static concepts

View Answers

June 4, 2012 at 9:40 PM

if we need to execute class level one time execution code,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 from object to anther object,then go for static variables...(According to my knowledge)


June 5, 2012 at 5:47 PM

Basically static means that there will only be only one instance of that object (the object that is declared static) in the class. If an object is not declared static a new copy of that object is made for every instance of the class that is initialized. Another thing about static objects is that you can call them directly without having to initialize the class at all, which is why if you declare the function main as static then java does not have to initialize the object at all to access the entry point (main function)









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  Can i know the real time example for Static method and final variables with defenition? Thank you
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
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
IO concept
IO concept  Write a java program that moves the contents of the one file to another and deletes the old file.   Hi Friend, Try the following code: import java.io.*; class MoveFile{ public static void main(String
Thread concept
("Interrupted"); } System.out.println(name+" exiting"); } } class Demojoin{ public static
Explain normalization concept?
Explain normalization concept?  Explain normalization concept
Concept of subqueires using JSP
Concept of subqueires using JSP  Can I implement the concept of sub queries in JSP page , if yes please tell me how this can be achieved. I have requirement where output of the SQL query should be given as input to the update
session concept - JSP-Servlet
session concept  Hello friends, How can we track unexpectedly closing a window when a jsp project running with session concept. And this tracking should update the log in status in data base
Session concept - JSP-Servlet
Session concept  Hai friends, I am doing a jsp project with session concept. If one person is not accessing his logged window for more than 10 minutes it gets automatically log out.Anybody explain me the reason
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT   Write a program that reads input from the console in the form of a string. When the user enters a word called end, the program should stop reading from the console and print out the values that have been
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT   Write a program that reads input from the console in the form of a string. When the user enters a word called end, the program should stop reading from the console and print out the values that have been
Explain the concept of thread priorities in Java.
Explain the concept of thread priorities in Java.  Explain the concept of thread priorities in Java
Java Inheritance Concept.
Java Inheritance Concept.  Yesterday i got confused with following question in an aptitude exam. Question:Class A,B,C have method named doit(). Class B extends Class A,Class C extends Class B.How will you call method doit
Write Full concept of abstract class
Write Full concept of abstract class  Abstract class
ModuleNotFoundError: No module named 'concept-formation'
ModuleNotFoundError: No module named 'concept-formation'  Hi, My... named 'concept-formation' How to remove the ModuleNotFoundError: No module named 'concept-formation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'concept-formation'
ModuleNotFoundError: No module named 'concept-formation'  Hi, My... named 'concept-formation' How to remove the ModuleNotFoundError: No module named 'concept-formation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'concept-py'
ModuleNotFoundError: No module named 'concept-py'  Hi, My Python... 'concept-py' How to remove the ModuleNotFoundError: No module named 'concept-py' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'concept-py'
ModuleNotFoundError: No module named 'concept-py'  Hi, My Python... 'concept-py' How to remove the ModuleNotFoundError: No module named 'concept-py' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'concept-formation'
ModuleNotFoundError: No module named 'concept-formation'  Hi, My... named 'concept-formation' How to remove the ModuleNotFoundError: No module named 'concept-formation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'concept-formation'
ModuleNotFoundError: No module named 'concept-formation'  Hi, My... named 'concept-formation' How to remove the ModuleNotFoundError: No module named 'concept-formation' error? Thanks   Hi, In your
static in java
static in java  what is the need to go static? what use
Concept error - WebSevices
Concept error  What is the difference between Joomla And Zend framework. Any one know the answer  Hi friend, Joomla CMS is a multi functional Open Source application for creating websites. It is free to 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
Java + Timer concept - Java Beginners
concept.  Hi Friend, Try the following code: import java.awt....*; public class Test{ final static int interval = 1000; int i; JLabel... static void main(String[] args) { Test spb = new Test(); } } Hope
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
PHP set static Method
_set_static()Method in PHP : In this tutorial we will study how to assign values of an object to another object dynamically. To do this we use __set_static() method. We need to declare a magic method called __set_static() which
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 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
concept Understatnding problem - Java Beginners
concept Understatnding problem  Even though I have studied in detail inheritance & interfaces in java , I fail to understand "How Interfaces Help in Multiple Inheritance ?" . Pls. Supplement ur ans. with an example. Thanx
Java Query(based on swing concept)
Java Query(based on swing concept)  I want a particular submit button to get disabled whenever i write some account number starting with 774 and 775 in a text box of that screen
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
Does javaScript have the concept level scope?
Does javaScript have the concept level scope?  Does javaScript have the concept level scope
static
demonstrate a) static data members b) static methods
demonstrate a) static data members b) static methods  demonstrate a) static data members b) static methods
Connected Mode and Dissconnect mode coding concept.
Connected Mode and Dissconnect mode coding concept.  Tell Me about Connected Mode and Dissconnect mode coding concept. also give me some syantax
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having... implements threading concept. i tried it simply by calling constructor... frame8 extends JPanel implements ActionListener { public static final int TILED
registration form using oop concept
JTableDatabase { public static void main(String[] args) { Vector columnNames = new Vector
static keyword with real example
static keyword with real example  static keyword with real examplestrong text
Java static import
Java static import  What is the use of static import
Java static method
Java static method  Can we override static methods
why using static keyword
why using static keyword  why using static keyword
About Static Class
About Static Class  is it neccessary to create object for static class
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which implements threading concept. i tried it simply by calling constructor
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

Ads