summaryrefslogtreecommitdiff
path: root/testsuite/java.lang/ClassForNameTest.java
blob: c69df932870e00fe8168287d72fa8ac2921437c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public class ClassForNameTest
{
  public static void main(String args[]) {
    Class c;
    /* test for both success and failure */

    try {
      c = Class.forName("ClassForNameTest");
    }
    catch (Exception e) {
      System.out.println("FAILED: Couldn't find ClassForNameTest.");
      System.exit(0);
    }

    try {
      c = Class.forName("ClazzForNameT3st");
    }
    catch (Exception e) {
      System.out.println("PASSED: passed both success and failure cases for Class.forName");
      System.exit(0);
    }

    System.out.println("FAILED: Didn't raise exception for incorrect class name.");
  }
}