String s = new String(“xyz”). How many objects has been made after this line of code execute?

THERE ARE ERRORS BELOW DEPENDING ON THE JVM/JRE THAT YOU USE. IT IS BETTER TO NOT WORRY ABOUT THINGS LIKE THIS ANYWAYS. SEE COMMENTS SECTION FOR ANY CORRECTIONS/CONCERNS. First, this question really asks about this addressed here: Is String Literal Pool a collection of references to the String Object, Or a collection of Objects So, … Read more

Value of static variable not changed even after initializing the child class in Java [duplicate]

The field y is not declared by class Checks. Reading static fields doesn’t trigger initialization of the referenced class (Checks), unless that class is the one in which the field is declared (see JLS quote below). In this example, even if y is accessed through Checks, that will only trigger the initialization of Par because … Read more

What flags are enabled by -XX:+AggressiveOpts on Sun JRE 1.6u20?

To check it for particular release: java -XX:-AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version > no_agg java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version > agg And then make diff (diff -U0 no_agg agg). For example, jdk 1.7.0_51: – bool AggressiveOpts := false {product} + bool AggressiveOpts := true {product} – intx AutoBoxCacheMax = 128 {C2 product} + intx AutoBoxCacheMax = … Read more

-XX:OnOutOfMemoryError=”kill -9 %p” Problem

In Java version 8u92 the VM arguments -XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError were added, see the release notes. ExitOnOutOfMemoryError When you enable this option, the JVM exits on the first occurrence of an out-of-memory error. It can be used if you prefer restarting an instance of the JVM rather than handling out of memory errors. CrashOnOutOfMemoryError If this … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)