Difficile
Parmi ces affirmations correspondant au langage Java, lesquelles sont vraies ?
Auteur: Thomas De verdièreStatut : PubliéeQuestion passée 2689 fois
Modifier
2
Évaluations de la communauté
Réponse incorrecte
Mohamed13/06/2024
Let's evaluate each statement regarding Java:
A Java class must be compiled to be executed.
True. Java source code is compiled into bytecode (.class files) using the Java compiler (javac). These bytecode files are then executed by the Java Virtual Machine (JVM). So, compilation is necessary for execution.
A Java class is interpreted when it is executed.
False. In modern Java implementations, bytecode is typically compiled to native machine code at runtime using techniques such as Just-In-Time (JIT) compilation. This native code execution is not pure interpretation. Older JVMs did use interpretation more prominently, but modern JVMs optimize bytecode through various compilation strategies.
The execution time of a Java method is always predictable to the nearest millisecond.
False. The execution time of a Java method can be influenced by factors such as JVM optimizations, garbage collection pauses, system load, and hardware performance. While Java provides mechanisms for measuring time (System.nanoTime() and System.currentTimeMillis()), the exact execution time can vary and is not always predictable to the nearest millisecond.
The maximum size of a Java class is 4KB.
False. There is no specific maximum size for a Java class defined as 4KB. The size of a Java class file can vary based on its content, the number of methods, fields, and dependencies it has. The JVM imposes practical limits on class file size based on its internal constraints and system memory, but there is no fixed size limit like 4KB.
Therefore, the true statement among the options provided is:
A Java class must be compiled to be executed.
Questions similairesPlus de questions sur Java
12
Combien de fois la condition `(a++ < 15)` est-elle évaluée dans le code suivant ?
```java
int a = 3;
while (a++ < 15) {
if ((a++ % 5) == 0)
break;
}
```9
Un moniteur en Java8
Combien d'instances de Integer ne peuvent pas être libérées de la mémoire?8
Une classe Customer a le package com.company.model.6
Que signifie le mot-clé final devant une méthode en Java?