If your team member writes code with lots of static
variables and static methods, will it cause any side effects?

Answer Posted / eknath wagadre

Yes!!! We can define the several static method and variable
and those are vary easy to access by Class Name or by class
instance.

But Only problem with static method and variable is that
there is Maximum chance of data corruption. bcz of static
method and variable are accessed by diff-2 thread at the
same time. Mean at the same time one or more then one thread
can change the value of static variable.

So conclusion is this if we can define more static variable
and method so and our program have hug line of code at that
time programs output may be inconsistent.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by garbage collection in Java? Can it be forced to run?

751


Define inheritance with reference to java.

796


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

887


we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

1805


How will you add panel to a frame?

854


Why we go for collections in java?

752


Why are the destructors for base class and derived class called in reverse order when the program exits

1931


What does it mean that a method or field is “static”?

719


What's the default access specifier for variables and methods of a class?

771


How do you convert boolean to boolean?

787


Can I declare class as static or private?

750


What is the difference between the font and fontmetrics classes in java programming?

704


What is immutable class in java?

706


Is a case study a method or methodology?

655


What does || mean in code?

792