Before starting your job search, look at these common Java interview questions asked during real interviews and understand the answers, but instead of memorizing the answers try to complete further research and come with your own personal solution for the interview question. The more prepared you are for what you will encounter, the more successful you will be. This collection of Java interview question could be also useful for software developers who need to interview Java developer.

Java Interview Question 6: Explain JVM memory structure?

Some Java software developers think that they do need to know about JVM memory structure and wrongly assume that Java code written by them will always work if they were able to compile and run the application at least once. Unfortunately this is not a true, so the interviewer should always ask at least one question on JVM memory structure and tuning. The interviewer would expect that software programmer should be able to explain the segments of JVM memory. There are two of them: heap memory and non-heap memory. Heap memory is the storage for Java objects and sometimes it is called as shared memory, because multiple threads will share the same data in heap memory. The heap memory may be of a fixed or variable size. Non-heap memory is a memory other than the heap memory and also could be a fixed or variable size. Non-heap memory stores per-class structures such as runtime constant pool, static fields and method data, and the code for methods and constructors. Keep in mind that JVM implementation may require memory for internal processing or optimization which also seats in non-heap memory.

No comments: