Question d’entretien chez IBM

What is the difference between JDK and JRE? Answer: JDK (Java Development Kit) is a software development kit used to develop Java applications, while JRE (Java Runtime Environment) is used to run Java applications. JDK includes JRE along with development tools like compilers and debuggers. What are the different types of loops in Java? Answer: The main loops in Java are for, while, and do-while. Each is used for repeating a block of code multiple times with different conditions and iteration patterns. Explain Java's memory management. Answer: Java uses automatic garbage collection to manage memory. The JVM (Java Virtual Machine) allocates memory for objects on the heap, and the garbage collector reclaims memory by removing objects that are no longer reachable. What is polymorphism in Java? Answer: Polymorphism is the ability of one method or object to take many forms. It can be achieved via method overriding (runtime polymorphism) and method overloading (compile-time polymorphism).