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

Which api is provided by java for operations on set of objects?

919


What is a stack class in java ?

614


Can you override static methods?

506


Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).

1609


why an outer class cannot be declared as private?

3621






What are thread priorities and importance of thread priorities in java?

628


How many types of gc are there in java?

572


What is a constructor overloading in java?

530


What is a singleton class in Java?

514


Is set sorted in java?

523


What is the exact difference in between Unicast and Multicast object? Where will it be used?

589


What is jvm? How its run?

666


Why is it called boolean?

527


How do I get the | symbol on my keyboard?

597


What is getkey () in java?

581