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|
|Ans. Yes, doesn't provide exclusive access as we cannot allocate and deallocate memory exclusively as Java internally manages it. The advantage of this is that it relieves the coder for such tasks and helps protect from many bugs that may get introduced with imperfect coding. Moreover as java garbage collector collects all unclaimed memory or objects, it helps the application from memory leaks. |
On the flip side , as coder doesn't have extensive excess to memory , it is upto java to decide on the state for programming construct and data storage and hence may introduce some security risks. For example - Java keeps string literals in string pool and there is no exclusive way to remove it and hence may stay and sensitive data in string pool may introduce security issues. Moreover when we overwrite a value or object for a variable / reference, it is upto java to purge those values and hence it may stay in memory for a while till java decide that it is no longer referenced and hence should be removed and hence makes it vulnerable for inappropriate access.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  disadvantages of garbage collection  advantages and disadvantages of java memory management  java for security applications  java with sensitive data  memory management|
|Does garbage collection guarantee that a program will not run out of memory?|
|What are different ways to create String Object? Explain.|
|Describe, in general, how java's garbage collector works ?|
|Describe what happens when an object is created in Java ?|
|What are various types of Class loaders used by JVM ?|
|Why two types of memory - stack and heap are required by Java ?|
|Should we override finalize method ?|
|What are strong, soft, weak and phantom references in Java ?|
|Which memory areas does instance and static variables use ?|
|Can we call the garbage collector explicitly ?|