-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapper_class_concept.java
More file actions
58 lines (49 loc) · 1.57 KB
/
wrapper_class_concept.java
File metadata and controls
58 lines (49 loc) · 1.57 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package Package;
import java.util.Scanner;
public class WrapperClass {
public static void main(String[] args) {
//int a =20;
Scanner s = new Scanner(System.in);
try{
// System.exit(0);
int aa = s.nextInt();
int b = s.nextInt();
int arr[]={122,45,67,89,90};
//throw new ArithmeticException("/ by zero");
System.out.println(aa / b);//ArithmaticException because divide by Zero
int index= s.nextInt();
System.out.println(arr[index]);
}
catch (ArrayIndexOutOfBoundsException obj)
{
System.out.println(obj);
}
catch (ArithmeticException obj)//catch --> handler
{
System.out.println(obj);
}
catch (IllegalAccessError obj){
System.out.println(obj);
}
catch (Exception obj){
System.out.println(obj);
}
// finally {
// System.out.println("this is finally block");
// }
System.out.println("end of the line");
// Integer i1=78;//automatically boxing
// int i2=i1;//automatically unboxing
// System.out.println(i1.hashCode()+" "+i2);
//boxing
// Integer obj= Integer.valueOf(59);
// Integer obj2 = Integer.valueOf(59);
// System.out.println(obj.equals(obj2));
// System.out.println(obj.equals(obj));
//unboxing
// Integer obj = 20;
// double i= obj.floatValue();
// System.out.println(i);
// System.out.println(i/10);
}
}