File: ExceptionsTest.java

package info (click to toggle)
tya 1.6-1
  • links: PTS
  • area: contrib
  • in suites: potato
  • size: 628 kB
  • ctags: 843
  • sloc: ansic: 7,028; asm: 618; java: 497; makefile: 88; sh: 18
file content (31 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (2)
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
26
27
28
29
30
31
class ExceptionsTest 
{
  int i;
  public static void main(String[] argv) 
  {
    ExceptionsTest obj=null;
    try
       {
    	obj.i=123;
       }
    catch (NullPointerException ex)
       {
	System.out.println(ex);
        obj=new ExceptionsTest();
       }
    obj.i=1;
    System.out.println("Caught signal 11 in main...?: Yes!");
    System.out.println("obj.i="+obj.i);
     
    int a=1;int b=0;
    try
       {
        a/=b;
       }
    catch (Exception ex)
       {
	    System.out.println(ex);
       }
     System.out.println("Caught signal 8 in main...?: Yes!");
    }
}