11. int x = 3; 12. int y = 1; 13. if (x = y) { 14. System.out.println(“x = “ + x); 15. }
Show comments for this question (0) Add comments Link to this question
1. public class Test { 2. public static void aMethod() throws Exception { 3. try { 4. throw new Exception(); 5. } finally { 6. System.out.println(“finally”); 7. } 8. } 9. public static void main(String args[]) { 10. try { 11. aMethod(); 12. } catch (Exception e) { 13. System.out.println(“exception”); 14. } 15. System.out.println(“finished”); 16. } 17. }
1. public interface Foo { 2. int k = 4; 3. }
1. package test1; 2. public class Test1 { 3. static int x = 42; 4. } 1. package test2; 2. public class Test2 extends test1.Test1 { 3. public static void main(String[] args) { 4. System.out.println(“x = “ + x); 5. } 6. }
1. class A { 2. protected int method1(int a, int b) { return 0; } 3. }
1. public class Delta { 2. static boolean foo(char c) { 3. System.out.print(c); 4. return true; 5. } 6. public static void main( String[] argv ) { 7. int i =0; 8. for ( foo(‘A’); foo(‘B’)&&(i<2); foo(‘C’)){ 9. i++ ; 10. foo(‘D’); 12. } 13. } 14. }
1. public class Test{ 2. public static void main( String[] argv ){ 3. // insert statement here 4. } 5. }
1. public class ArrayTest { 2. public static void main(String[] args) { 3. float fl[], f2[]; 4. fl = new float[10]; 5. f2 = f1; 6. System.out.println(“f2[0]= “ + f2[0]); 7. } 8. }
1. public class Test { 2. public int aMethod() { 3. static int i = 0; 4. i++; 5. return i; 6. } 7. public static void main (String args[]) { 8. Test test = new Test(); 9. test.aMethod(); 10. int j = test.aMethod(); 11. System.out.println(j); 12. } 13. }
1. class Super { 2. public float getNum() { return 3.0f; } 3. } 4. 5. public class Sub extends Super { 6. 7. }