/** * class CompileError */ public class CompileError { private static final class MethodProvider { // If you remove the 'throws Exception': The error Message disapears public Object openAppletJarOf(Object o) throws Exception { return null; } } /** * This method compiles with a Compiler Error: * "The local variable oResult may not have been initialized" * Question: Why? */ public static Object badUninitializedVariableErrorMessage() throws Exception { final MethodProvider oMethodProvider = new MethodProvider(); final boolean bFlag1 = !true, bFlag2 = !true; // If you uncomment the next if-else: The error Message disapears if (!bFlag1) { final Object o2 = null; } else { final Object o2 = oMethodProvider.openAppletJarOf(null); } final Object oResult, o1 = null; if (o1 != null) { oResult = null; oMethodProvider.openAppletJarOf(null); } else { // If you uncomment the next line: The error Message disapears final Object o4 = oMethodProvider.openAppletJarOf(null); oResult = null; } return oResult; } }