Does concatenation take precedence over addition? What gets printed out with the following code?
public class concat_test { public static void main (String[] argv) { int i=5, j=6; System.out.println (i+j); } } Solution: addition has precedence and thus 11 gets printed out. However, parsing is done left to right, and can create strange effects: public class concat_test { public static void main (String[] argv) { int i=5, j=6; System.out.println (i+j); // 11 System.out.println ((i)+(j)); // 11 System.out.println (i + “” + j); // 56 System.out.println (“” + i + j); // 56 System.out.println (i + j + “”); // 11 } } • When the compiler compiles a class that imports a package, is the package compiled too? The answer is simple, but complicated to test: the compiler does it best to use a current version. Here’s a bunch of tests and a conclusion: • I created a simple class and placed it within a package. • I created another test class that used the package. • Test 1: • I did not compile the package class at all and tried compiling the test class. • The compiler compiled the package class fo