File tree 10 files changed +142
-10
lines changed 10 files changed +142
-10
lines changed Original file line number Diff line number Diff line change 11
11
" 6.String" ,
12
12
" 7.InputOutput" ,
13
13
" 8,Method"
14
- ]
14
+ ],
15
+ "java.debug.settings.onBuildFailureProceed" : true
15
16
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
package PractiseCodes ;
2
2
class Demo {
3
3
4
- public void main (String [] args ){
4
+ public static void main (String [] args ){
5
5
6
6
// float var1 = 12.5f;
7
7
// // float var2 = 23.5f;
8
8
9
9
// System.out.println(var1);
10
+ System .out .println ("He" );
10
11
}
11
12
}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ static int[] getConcatenation(int[] nums) {
44
44
for (int i =0 ;i <nums .length ;i ++){
45
45
res [i ] = nums [j ];
46
46
res [2 *i +nums .length -i ] = nums [j ];
47
- j ++;
47
+ j ++;
48
48
}
49
49
50
50
return res ;
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ public static void main(String[] args) {
15
15
16
16
while (st .hasMoreElements ()){
17
17
18
- System .out .println (st .nextElement ());
18
+ System .out .println ( st .nextElement ().getClass ().getClassLoader ());
19
+
20
+ // st.nextElement().getClass().getClassLoader();
19
21
}
20
22
}
21
23
}
Original file line number Diff line number Diff line change 1
1
2
2
package ClassCodes ;
3
3
4
- public class program1 {
4
+ public class methodDemo1 {
5
5
6
6
int x =10 ;
7
7
static void fun (){
@@ -15,9 +15,10 @@ void gun(){
15
15
16
16
public static void main (String [] args ) {
17
17
18
- program1 obj = new program1 ();
18
+ methodDemo1 obj = new methodDemo1 ();
19
19
20
- gun ();
20
+ obj .gun ();
21
+ // gun();
21
22
}
22
23
}
23
24
Original file line number Diff line number Diff line change
1
+
2
+
3
+ package ClassCodes ;
4
+ public class methodDemo2 {
5
+
6
+ static int x =10 ;
7
+ int y =20 ;
8
+
9
+ static void gun (){
10
+ System .out .println ("Inside Gun method...!" );
11
+ }
12
+
13
+ void fun (){
14
+ System .out .println ("Inside fun method...!" );
15
+ }
16
+
17
+ public static void main (String [] args ) {
18
+
19
+ gun ();
20
+ System .out .println (x );
21
+
22
+ System .out .println ("After creating the object " );
23
+
24
+ methodDemo2 obj = new methodDemo2 ();
25
+
26
+ obj .fun ();
27
+ System .out .println (obj .y );
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ package ClassCodes ;
2
+
3
+ public class methodDemo3 {
4
+
5
+ int x =10 ;
6
+ static final int z =90 ;
7
+
8
+ static int y =20 ;
9
+
10
+ void fun (){
11
+ System .out .println (x );
12
+ System .out .println (y );
13
+ // System.out.println(z);
14
+
15
+ }
16
+ public static void main (String [] args ) {
17
+
18
+ methodDemo3 obj = new methodDemo3 ();
19
+
20
+ obj .fun ();
21
+ System .out .println (z );
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ package ClassCodes ;
2
+
3
+ import java .io .BufferedReader ;
4
+ import java .io .InputStreamReader ;
5
+
6
+ public class methodDemo4 {
7
+
8
+ static int add (int a ,int b ){
9
+ return a +b ;
10
+ }
11
+
12
+ static int sub (int a ,int b ){
13
+ return a -b ;
14
+ }
15
+
16
+ static int mult (int a ,int b ){
17
+ return a *b ;
18
+ }
19
+
20
+ static int div (int a ,int b ){
21
+ return a /b ;
22
+ }
23
+
24
+ public static void main (String [] args )throws Exception {
25
+
26
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
27
+
28
+ System .out .println ("Enter the two numbers: " );
29
+ int a = Integer .parseInt (br .readLine ());
30
+ int b = Integer .parseInt (br .readLine ());
31
+
32
+ System .out .println ("Addition: " +add (a , b ));
33
+ System .out .println ("Subtraction: " +sub (a , b ));
34
+ System .out .println ("Multiplication: " +mult (a , b ));
35
+ System .out .println ("Division: " +div (a , b ));
36
+ }
37
+ }
Original file line number Diff line number Diff line change
1
+ package ClassCodes ;
2
+
3
+ import java .io .BufferedReader ;
4
+ import java .io .InputStreamReader ;
5
+
6
+ public class methodDemo5 {
7
+
8
+ static int add (){
9
+ return a +b ;
10
+ }
11
+
12
+
13
+ public static void main (String [] args )throws Exception {
14
+
15
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
16
+
17
+ System .out .println ("Enter the two numbers: " );
18
+ int a = Integer .parseInt (br .readLine ());
19
+ int b = Integer .parseInt (br .readLine ());
20
+
21
+ System .out .println ("Addition: " +add ());
22
+ }
23
+ }
24
+
25
+
26
+ /*
27
+
28
+ .\methodDemo5.java:9: error: cannot find symbol
29
+ return a+b;
30
+ ^
31
+ symbol: variable a
32
+ location: class methodDemo5
33
+ .\methodDemo5.java:9: error: cannot find symbol
34
+ return a+b;
35
+ ^
36
+ symbol: variable b
37
+ location: class methodDemo5
38
+ 2 errors
39
+ error: compilation failed
40
+
41
+ */
You can’t perform that action at this time.
0 commit comments