☆Please write the output result :
public class Test {
public static void changeStr(String str){
str="welcome";
}
public static void main(String[] args) {
String str="1234";
changeStr(str);
System.out.println(str);
}
}
public static void changeStr(String str){
str="welcome";
}
public static void main(String[] args) {
String str="1234";
changeStr(str);
System.out.println(str);
}
}

☆What is the result?
public class Test {
static boolean foo(char c) {
System.out.print(c);
return true;
}
public static void main( String[] argv ) {
int i =0;
for ( foo('A'); foo('B')&&(i<2); foo('C')){
i++ ;
foo('D');
}
}
}
static boolean foo(char c) {
System.out.print(c);
return true;
}
public static void main( String[] argv ) {
int i =0;
for ( foo('A'); foo('B')&&(i<2); foo('C')){
i++ ;
foo('D');
}
}
}
A. ABDCBDCB
B. ABCDABCD
C. Compilation fails.
D. An exception is thrown at runtime.
B. ABCDABCD
C. Compilation fails.
D. An exception is thrown at runtime.

☆Which two are valid in a class that extends class A? (Choose two)
class A {
protected int method1(int a, int b) { return 0; }
}
protected int method1(int a, int b) { return 0; }
}
A. public int method1(int a, int b) { return 0; }
B. private int method1(int a, int b) { return 0; }
C. private int method1(int a, long b) { return 0; }
D. public short method1(int a, int b) { return 0; }
E. static protected int method1(int a, int b) { return 0; }
B. private int method1(int a, int b) { return 0; }
C. private int method1(int a, long b) { return 0; }
D. public short method1(int a, int b) { return 0; }
E. static protected int method1(int a, int b) { return 0; }

☆Which instantiates an instance of Inner?
public class Outer {
public void someOuterMethod() {
// Line 3
}
public class Inner {
}
public static void main(String[] argv) {
Outer o = new Outer();
// Line 8
}
}
public void someOuterMethod() {
// Line 3
}
public class Inner {
}
public static void main(String[] argv) {
Outer o = new Outer();
// Line 8
}
}
A. new Inner(); // At line 3
B. new Inner(); // At line 8
C. new o.Inner(); // At line 8
D. new Outer.Inner(); // At line 8//new Outer().new Inner()
B. new Inner(); // At line 8
C. new o.Inner(); // At line 8
D. new Outer.Inner(); // At line 8//new Outer().new Inner()

☆找錯?
public class Test {
public Test(int a){
}
public static void main(String args[]){
Test t=new Test();
}
}
public Test(int a){
}
public static void main(String args[]){
Test t=new Test();
}
}

☆輸出結果
System.out.println(1+'\2');
System.out.println(1+'2');
System.out.println(1+2+"3"+4+5);
System.out.println(1+'2');
System.out.println(1+2+"3"+4+5);
