Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Invoker.java 449B

123456789101112131415
  1. public class Invoker {
  2. public static void main(String[] args) throws Throwable {
  3. try {
  4. new C();
  5. }
  6. catch (Throwable t) {
  7. boolean failedCorrectly =
  8. t.toString().contains("Unresolved compilation problem") &&
  9. t.toString().contains("The method main cannot be declared static");
  10. if (failedCorrectly)
  11. return;
  12. throw new RuntimeException("Constructor call should have failed!", t);
  13. }
  14. }
  15. }