Java Interview Questions – Java Concepts

  • What are the different types of memory areas allocated by JVM?
    • Class (Method) Area – stores per-class structures like fields, method data, method code and constant pool.
    • Heap – runtime area where the actual objects reside.
    • Stack – holds local variables and partial results and plays a pivotal role in method invocation and return. For each thread created, private JVM stack is being created and maintained. It stores each method invocation in the form of a frame and its destroyed soon after the method invocation is complete.
    • Program Counter (PC) Register – it contains the currently executed Java Virtual Machine instruction.
    • Native Method Stack – contains all the native method used in the application.
  • What makes Java software-based platform to be called as “write once run anywhere”?

Because of the program being compiled into bytecode and this bytecode being run inside a runtime environment (JVM) makes this software-based platform able to run on top of other hardware-based platforms. The JVM though is platform dependent and is available for various hardware-platforms available.

  • Does Java support multiple inheritance?

Theoretically on the class level Java doesn’t support multiple inheritance to avoid complexity and with the aim of simplifying the language. Having said that using interfaces it does support multiple inheritance and is widely used.

  • What is Association, Aggregation and Composition?

I wouldn’t want to reinvent and write answer for this question, rather I would point you directly to this link here.

  • What is meant by Abstraction, Generalization, Realization and Dependency?

Again read the link here and you will get all the relevant details.

Page Visitors: 439

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *