Given:
public class Main { static StringBuffer sb; StringBuffer sb2;//from ww w . j av a2s. c om public static void main(String[] args) { sb = sb.append(new Main().go(new StringBuffer("Python"))); System.out.println(sb); } { sb2 = new StringBuffer("Ruby "); } StringBuffer go(StringBuffer s) { System.out.print(s + " SQL " + sb2); return new StringBuffer("MySQL"); } static { sb = new StringBuffer("Java "); } }
What is the result?
E is correct.
The final contents of sb is "Java MySQL".
Remember that the static initializer runs before any instances are created.