File tree 7 files changed +85
-3
lines changed
7 files changed +85
-3
lines changed Original file line number Diff line number Diff line change 1
1
eclipse.preferences.version =1
2
2
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode =enabled
3
- org.eclipse.jdt.core.compiler.codegen.targetPlatform =14
3
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform =11
4
4
org.eclipse.jdt.core.compiler.codegen.unusedLocal =preserve
5
- org.eclipse.jdt.core.compiler.compliance =14
5
+ org.eclipse.jdt.core.compiler.compliance =11
6
6
org.eclipse.jdt.core.compiler.debug.lineNumber =generate
7
7
org.eclipse.jdt.core.compiler.debug.localVariable =generate
8
8
org.eclipse.jdt.core.compiler.debug.sourceFile =generate
@@ -11,4 +11,4 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier =error
12
12
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures =warning
13
13
org.eclipse.jdt.core.compiler.release =enabled
14
- org.eclipse.jdt.core.compiler.source =14
14
+ org.eclipse.jdt.core.compiler.source =11
Original file line number Diff line number Diff line change
1
+
2
+ public class AnotherClass {
3
+ public static void main (String [] args ) {
4
+ System .out .println ("Hello World !!!" );
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+
3
+ public class CheckAge {
4
+
5
+ public static void main (String [] args ) {
6
+ int age = getAge ();
7
+ if (age < 0 )
8
+ System .out .println ("Invalid age entered." );
9
+ else if (age < 18 )
10
+ System .out .println ("Person is a minor." );
11
+ else
12
+ System .out .println ("Person is an adult." );
13
+ }
14
+
15
+ private static int getAge () {
16
+ Scanner scanner = new Scanner (System .in );
17
+
18
+ System .out .println ("Input age to be checked: " );
19
+
20
+ if (scanner .hasNextInt ()) {
21
+ int age = scanner .nextInt ();
22
+ scanner .close ();
23
+
24
+ if (age >= 0 )
25
+ return age ;
26
+ }
27
+
28
+ return -1 ;
29
+ }
30
+
31
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ public static void main(String[] args) {
8
8
9
9
System .out .println ("Square of 10 is: " + numSquared );
10
10
System .out .println ("Cube of 10 is: " + numCubed );
11
+
11
12
12
13
}
13
14
Original file line number Diff line number Diff line change
1
+
2
+ public class FirstPrg {
3
+ public static void main (String [] args ) {
4
+ int no = 100 ; // initialize variable
5
+ int num ; // Declare variable
6
+ num = 200 ; // Assigning value to variable
7
+
8
+ int add = no + num ;
9
+ System .out .println ("Addition : " + add );
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+
2
+ public class Loop {
3
+ public static void main (String [] args ) {
4
+ int no = 1 ;
5
+ int lastNo = 10 ;
6
+
7
+ while (no <= lastNo ) {
8
+ System .out .print (no + ", " );
9
+ no ++;
10
+ }
11
+
12
+ no = 100 ;
13
+ do {
14
+ System .out .println ("\n \n Iside do_while" );
15
+ System .out .println ("no = " + no );
16
+ } while (no <= lastNo );
17
+
18
+ for (no = 1 ; no <=10 ; no ++) {
19
+ System .out .print (no + ", " );
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+
2
+ public class WorkingWithSop {
3
+ public static void main (String [] args ) {
4
+ int no = 10 ;
5
+ int nextNum = 20 ;
6
+
7
+ System .out .println ("no + nextNum = " + (no + nextNum ));
8
+ System .out .println (no + " + " + nextNum + " = " + no + nextNum );
9
+ System .out .println (no + nextNum + " = " + no + nextNum );
10
+ }
11
+ }
You can’t perform that action at this time.
0 commit comments