Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| |||||||||||
Interview Questions and Answers - Order By Newest | |||||||||||
| |||||||||||
Ans. We can use PowerMockito.verifyStatic for this purpose PowerMockito.verifyStatic(VerificationModeFactory.times(1)); <Class_Name>.<static_method_name>; | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  mocking static methods | |||||||||||
Related Questions | |||||||||||
Have you ever tried mocking static methods ? | |||||||||||
Have you ever used PowerMock ? If yes , which mocking framework you have used it with ? | |||||||||||
| |||||||||||
Ans. No. When we declare a method static, it means that "this belongs to class as whole and not particular instance". The whole purpose of constructor is to initialize a object and hence there is no sense having static constructor. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  constructor  static  static constructor Asked in 1 Companies | |||||||||||
Related Questions | |||||||||||
What are the common uses of "this" keyword in java ? | |||||||||||
Can we use both "this()" and "super()" in a constructor ? | |||||||||||
Why every object constructor automatically call super() in Object before its own constructors? | |||||||||||
Can constructors be synchronized in Java ? | |||||||||||
Does Constructor creates the object ? | |||||||||||
What are constructors and Destructors in Java ? | |||||||||||
Are constructors inherited? Can a subclass call the parent's class constructor? When? | |||||||||||
Difference between object instantiation and construction ? | |||||||||||
How can we create objects if we make the constructor private ? | |||||||||||
Difference Between this() and super() ? | |||||||||||
| |||||||||||
Ans. Yes the value of a static variable can be changed. It's the final keyword that restrict the modification of value not static. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  static variables | |||||||||||
Related Questions | |||||||||||
Difference between == and .equals() ? | |||||||||||
Why is String immutable in Java ? | |||||||||||
Explain the scenerios to choose between String , StringBuilder and StringBuffer ? or What is the difference between String , StringBuilder and StringBuffer ? | |||||||||||
What are the difference between composition and inheritance in Java? | |||||||||||
Explain OOPs or Explain OOPs Principles or Explain OOPs Concepts or Explain OOPs features or Tell me something about OOPs | |||||||||||
What is a Lambda Expression ? What's its use ? | |||||||||||
Why Char array is preferred over String for storing password? | |||||||||||
What are different ways to create String Object? Explain. | |||||||||||
Does garbage collection guarantee that a program will not run out of memory? | |||||||||||
What is the difference between final, finally and finalize() ? | |||||||||||
| |||||||||||
| |||||||||||
| |||||||||||
| |||||||||||