File tree Expand file tree Collapse file tree 12 files changed +324
-0
lines changed Expand file tree Collapse file tree 12 files changed +324
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <classpath >
3
+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7" />
4
+ <classpathentry kind =" src" path =" src" />
5
+ <classpathentry kind =" output" path =" bin" />
6
+ </classpath >
Original file line number Diff line number Diff line change
1
+ /bin /
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <projectDescription >
3
+ <name >Lecture Example BAO 2019</name >
4
+ <comment ></comment >
5
+ <projects >
6
+ </projects >
7
+ <buildSpec >
8
+ <buildCommand >
9
+ <name >org.eclipse.jdt.core.javabuilder</name >
10
+ <arguments >
11
+ </arguments >
12
+ </buildCommand >
13
+ </buildSpec >
14
+ <natures >
15
+ <nature >org.eclipse.jdt.core.javanature</nature >
16
+ </natures >
17
+ </projectDescription >
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode =enabled
3
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform =1.7
4
+ org.eclipse.jdt.core.compiler.codegen.unusedLocal =preserve
5
+ org.eclipse.jdt.core.compiler.compliance =1.7
6
+ org.eclipse.jdt.core.compiler.debug.lineNumber =generate
7
+ org.eclipse.jdt.core.compiler.debug.localVariable =generate
8
+ org.eclipse.jdt.core.compiler.debug.sourceFile =generate
9
+ org.eclipse.jdt.core.compiler.problem.assertIdentifier =error
10
+ org.eclipse.jdt.core.compiler.problem.enumIdentifier =error
11
+ org.eclipse.jdt.core.compiler.source =1.7
Original file line number Diff line number Diff line change
1
+ package com .rt ;
2
+
3
+ class Break {
4
+ public static void main (String [] args ) {
5
+
6
+ int [][] arrayOfInts = {
7
+ { 32 , 87 , 3 , 589 },
8
+ { 12 , 1076 , 2000 , 8 },
9
+ { 622 , 127 , 77 , 955 }
10
+ };
11
+ int searchfor = 12 ;
12
+
13
+ int i ;
14
+ int j = 0 ;
15
+ boolean foundIt = false ;
16
+
17
+
18
+
19
+ xyz :
20
+ for (i = 0 ; i < 3 ; i ++) {
21
+ for (j = 0 ; j < 4 ;j ++) {
22
+ if (arrayOfInts [i ][j ] == searchfor ) {
23
+ foundIt = true ;
24
+ break xyz ;
25
+ }
26
+ }
27
+ }
28
+
29
+
30
+ if (foundIt ) {
31
+ System .out .println ("Found " + searchfor + " at " + i + ", " + j );
32
+ } else {
33
+ System .out .println (searchfor + " not in the array" );
34
+ }
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ package com .rt ;
2
+
3
+ public class ConstructorExample {
4
+
5
+ public void fun ()
6
+ {
7
+ System .out .println ("i am from function of class" );
8
+ }
9
+
10
+
11
+
12
+ @ Override
13
+ public String toString () {
14
+ // TODO Auto-generated method stub
15
+ return "Hello from sub class" ;
16
+ }
17
+ public static void main (String [] args ) {
18
+ // TODO Auto-generated method stub
19
+
20
+ ConstructorExample obj =new ConstructorExample ();
21
+ Object oo =new Object ();
22
+
23
+
24
+
25
+
26
+ System .out .println (obj .toString ());
27
+ System .out .println (oo .toString ());
28
+
29
+
30
+ //obj.fun();
31
+
32
+
33
+
34
+ }
35
+
36
+ }
Original file line number Diff line number Diff line change
1
+ package com .rt ;
2
+ class Continue extends Break {
3
+ public static void main (String [] args ) {
4
+
5
+ String searchMe = "Look for a substring in me" ;
6
+ String substring = "sub" ;
7
+ boolean foundIt = false ;
8
+
9
+
10
+
11
+
12
+ int max = searchMe .length () -
13
+ substring .length ();
14
+ test :
15
+
16
+ for (int i = 0 ; i <= max ; i ++) {
17
+ int n = substring .length ();
18
+ int j = i ;
19
+ int k = 0 ;
20
+ while (n -- != 0 ) {
21
+ if (searchMe .charAt (j ++) != substring .charAt (k ++)) {
22
+ continue test ;
23
+ }
24
+ }
25
+ foundIt = true ;
26
+ break test ;
27
+ }
28
+ System .out .println (foundIt ? "Found it" : "Didn't find it" );
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ package com .rt ;
2
+
3
+
4
+
5
+ public class Test {
6
+
7
+ /**
8
+ * @param args
9
+ */
10
+ public static void main (String [] args ) {
11
+ // TODO Auto-generated method stub
12
+ String ob ="T" ;
13
+ // System.out.println(ob.charAt(1));
14
+ //
15
+ Character a =ob .charAt (0 );
16
+ String r =a .toString ();
17
+ System .out .println (Integer .parseInt (r ));
18
+
19
+
20
+ }
21
+
22
+ }
Original file line number Diff line number Diff line change
1
+ package com .rt ;
2
+
3
+ public class ellipse {
4
+
5
+ /**
6
+ * @param args
7
+ */
8
+
9
+
10
+ public static void fun (int ...a )
11
+ {
12
+ for (int i =0 ;i <a .length ;i ++)
13
+ {
14
+ System .out .println (a [i ]);
15
+ }
16
+ }
17
+ public static void main (String ... args ) {
18
+ // TODO Auto-generated method stub
19
+
20
+ fun (1 );
21
+ fun (2 ,3 );
22
+ fun (1 ,2 ,3 ,4 ,5 );
23
+ }
24
+
25
+ }
Original file line number Diff line number Diff line change
1
+ package com .rt .nestedclass ;
2
+
3
+ public class CarParts {
4
+
5
+ int id =1 ;
6
+ static int factoryid =1234 ;
7
+
8
+
9
+ public void fun ()
10
+ {
11
+ System .out .println ("Hello from outer class" );
12
+ }
13
+
14
+
15
+ public static void f ()
16
+ {
17
+ System .out .println ("I am static function" );
18
+ }
19
+
20
+ public CarParts () {
21
+ System .out .println ("CarPart Object Created" );
22
+ }
23
+
24
+ public static class StaticNestedWheelClass
25
+ {
26
+ static int a =10 ;
27
+ int id_wheel ;
28
+
29
+ void fun2 ()
30
+ {
31
+ System .out .println ("Hello" );
32
+ f ();
33
+ }
34
+ public StaticNestedWheelClass () {
35
+ System .out .println ("Wheel Created from Factory" +factoryid );
36
+ // System.out.println("Car Part Id"+id); // *****observe the error
37
+ }
38
+ }
39
+
40
+ public class WheelInnerClass
41
+ {
42
+ // static int g=90; //*********observe the error
43
+ int b =20 ;
44
+ public WheelInnerClass () {
45
+ System .out .println ("Wheel Created from Inner Class with FactoryId" +factoryid );
46
+ System .out .println ("Car Part Id" +id );
47
+ }
48
+ }
49
+
50
+
51
+ }
You can’t perform that action at this time.
0 commit comments