File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ package Applications ;
12import java .util .Scanner ;
23
34import javax .sql .rowset .spi .SyncResolver ;
Original file line number Diff line number Diff line change 1+ package Applications ;
2+ import java .util .Scanner ;
3+
4+ class application {
5+ public static String oddeven (int b ){
6+ if (b %2 ==0 ){
7+ return ("The value is Even" );
8+ }
9+ else {
10+ return ("The value is Odd" );
11+ }
12+
13+
14+ }
15+
16+
17+ public static void main (String args []){
18+ Scanner input =new Scanner (System .in );
19+ System .out .println ("Enter the value:" );
20+ int a =input .nextInt ();
21+ System .out .println ("You entered value is:" +a );
22+
23+ for (int i =0 ;i <=a ;i ++){
24+ System .out .println (i );
25+ }
26+ if (a ==10 ){
27+ for (int j =1 ;j <=5 ;j ++){
28+ System .out .println ("Java darling !!" );
29+ }}
30+ else {
31+ System .out .println ("Hi Java" );
32+ }
33+ System .out .println ("Type value to check odd or even:" );
34+ int c =input .nextInt ();
35+ System .out .println (oddeven (c ));
36+
37+ String [] array =new String [5 ];
38+
39+ }
40+ }
41+
42+
43+
Original file line number Diff line number Diff line change 1+ import java .util .*;
2+
3+ class JavaException {
4+
5+
6+ public static void main (String args []){
7+ Scanner input = new Scanner (System .in );
8+ System .out .println ("Enter the value:" );
9+ int val =input .nextInt ();
10+ try {
11+ int data =val /0 ;
12+ }
13+ catch (ArithmeticException a ){
14+ System .out .println (a );
15+ }
16+ System .out .println ("Hello Exeption Handling" );
17+ }
18+ }
You canβt perform that action at this time.
0 commit comments