When we can access the static data member without creating
the object what is the need of the object in java.
Answer Posted / paras bist
Static data is class level data,while objects contain
values of non static instancs varibles.
diffrent object contains diffrent values of instance
varibles ,
but all object can share same vale of static data.
Class abc{
int i;
int j;
static int x=10;
//-----some more code
}
diffrent object contain diffrent values of i&j,
but all object can share one value of x(ie 10 coz it is
static).
static data is accessed by class name and object also.
Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
How to perform linear search in java?
Can I use % with real numbers?
Explain the difference between extends thread vs implements runnable in java?
What is the collections api in java programming?
What is java developer skills?
What is the use of optional ?
What do you mean by global variable?
How can we use primitive data types as objects?
What is thread pool in java with example?
Why is serialization required?
How to change value in arraylist java?
Difference between static and dynamic class loading.
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
What is an i/o filter?