Тесты
Язык сайта: Русский
Українська
English
Русский
Тесты по программированию
Вход
Регистрация
Тесты по программированию
Теория
сниппеты
Статьи
Главная
Android
Цены
FAQ
История Cosmo
Правила и условия сервиса
Политика конфиденциальности
Политика в отношении файлов cookie
Обратная Связь
exceptions
:
Язык контента: English
Русский
What will be printed out as the result of the following code execution? public class Exceptions { public static void main(String[] args) { try { throw new UnsupportedOperationException(); } catch(Throwable t) { System.out.print("1"); } catch(Exception e) { System.out.print("2"); } catch(UnsupportedOperationException uoe) { System.out.print("3"); } } }
exceptions
What will be printed as the result of the following program execution? public class C { public static void main(String[] args) { try { foo(); System.out.print("A "); } catch (Exception e) { System.out.print("B "); } finally { System.out.print("C "); } } private static void foo() throws Exception { try { System.out.print("A1 "); throw new Exception(); } catch (Exception e) { System.out.print("B1 "); throw new Exception(); } finally { System.out.print("C1 "); } } }
exceptions
Check all valid methods of creation of an Exception class.
exceptions
Presuming all required import statements are in place, which lines of the following code will cause a compilation error? 1: class A { 2: void m1() {throw new ArithmeticException();} 3: void m2() {throw new ClassCastException();} 4: void m3() {throw new IllegalArgumentException();} 5: void m4() {throw new IndexOutOfBoundsException();} 6: void m5() {throw new NullPointerException();} 7: void m6() {throw new SecurityException();} 8: }
exceptions
What will happen while running the following code? public class Test implements Runnable { public static void main(String[] args) { Thread t = new Thread(this); try { t.start(); } catch (IOException ioe) { System.out.println("IOException"); } } public void run() throws IOException { File f = new File("file.txt"); FileWriter fw = new FileWriter(f); } }
exceptions
What will be the result of execution of the following code? Set<Integer> numbers = new LinkedHashSet<Integer>(Arrays.asList(1,2,3,4)); for(Integer i : numbers) { if( i % 2 == 0) numbers.remove(i); } System.out.println(numbers);
exceptions
public class ExceptionTest { public static void errorHandling() { System.out.println("Error"); throw new IllegalAccessException(); } public static void main(String[] args) { try { errorHandling(); } catch (IllegalAccessException e) { System.out.println("Main error"); } } } What is the result of executing?
exceptions
What will be the result of compilation and execution of the following code? import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.*; @Retention(RetentionPolicy.RUNTIME) @interface Anno{ int value() default 5; } public class Test { @Anno(10) public static void test(int i) { } public static void main(String [] args) { Method m = new Test().getClass().getMethod("test"); Anno anno = m.getAnnotation(Anno.class); System.out.println(anno.value()); } }
exceptions
Does throw expression have a result type in Scala?
exceptions
Is it required to catch checked exceptions in Scala?
exceptions
← Предыдущая
1
2
3
Следующая →
Зарегистрируйся сейчас
или
Подпишись на будущие тесты