If your team member writes code with lots of static
variables and static methods, will it cause any side effects?
Answers were Sorted based on User's Feedback
Answer / abhinav
If the code is small, then there wont be any significant
problems, but if the program is huge, then it can severly
hamper the program performance. use of static
variables/methods are one of the biggest reasons for memory
leaks
| Is This Answer Correct ? | 6 Yes | 2 No |
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 |
What is an image buffer?
Give an example of call be reference significance.
what are the diffrences between interface and abstract class?
Give reasons supporting that string is immutable.
What is thread safe singleton?
Why do people says “java is robust”?
In a my eclipse editor if i want to switch from jdk 1.4 to jdk 1.6 how to do that???? Initially i have jdk1.4
what is the difference between static class and singleton class? can we create static class?
2 Answers L&T, Octazen, Vamsi Labs,
What do you understand by classes in java?
What is meant by class?
What do you mean by constructor?
What is a Null object?