File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .tj .algorithms .sort ;
2+
3+ /**
4+ * Created by 001 on 16/8/17.
5+ */
6+ public class SonCollections {
7+ }
Original file line number Diff line number Diff line change 1+ package org .tj .java8 .lambda ;
2+
3+ /**
4+ * Created by 001 on 16/8/17.
5+ */
6+ public class LambdaTest {
7+ }
Original file line number Diff line number Diff line change 1+ package org .tj .java8 .newinterface ;
2+
3+ /**
4+ * Created by 001 on 16/8/17.
5+ */
6+ public interface IDefault {
7+
8+ default void method1 (){
9+ System .out .println ("this is method1" );
10+ }
11+ void method2 ();
12+ }
13+
14+ class Default
Original file line number Diff line number Diff line change @@ -14,4 +14,8 @@ public void fly() {
1414 System .out .println ("Bird Fly" );
1515 }
1616
17+ public String getClassName (){
18+ return super .getClass ().getName ();
19+ }
20+
1721}
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ static void breath(Animal animal){
1111
1212 public static void main (String [] args ) {
1313 Bird bird = new Bird ();
14+
15+ System .out .println (bird .getClassName ());
16+
1417 bird .breathe ();
1518
1619 Animal animal = new Bird ();
Original file line number Diff line number Diff line change 1+ package org .tj .oop .innerclass ;
2+
3+ /**
4+ * Created by 001 on 16/8/18.
5+ */
6+ public class OutClass {
7+
8+ private String name = "out-private" ;
9+ static protected String name2 = "out-protected" ;
10+ public String name3 = "out-public" ;
11+
12+ static class InnerClass {
13+ static private String a ;
14+ public InnerClass (){
15+
16+ }
17+ }
18+
19+ public static void main (String [] args ) {
20+ char a ;
21+ a = 0 ;
22+ while (a <=1000 ){
23+ System .out .println (a ++);
24+ }
25+
26+ // System.out.println(a);
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ package org .tj .study .exceptions ;
2+
3+ import java .io .FileNotFoundException ;
4+ import java .io .FileReader ;
5+
6+ /**
7+ * Created by 001 on 16/8/18.
8+ */
9+ public class MyException extends Exception {
10+
11+ public MyException (){
12+
13+ }
14+
15+ public MyException (String message ){
16+ super (message );
17+ }
18+
19+ public MyException (String message ,Exception ex ){
20+ super (message ,ex );
21+ }
22+
23+ static void test (int i ) throws MyException {
24+
25+ if (i ==0 ){
26+ throw new MyException ("my exception" ,new Exception ());
27+ }
28+
29+
30+ }
31+
32+ static void testFile () throws MyException {
33+ try {
34+ FileReader fileReader = new FileReader ("F://sadas" );
35+ } catch (FileNotFoundException e ) {
36+ e .printStackTrace ();
37+ throw new MyException ("ny exception" ,e );
38+ }
39+ }
40+
41+ static int testFinally (int i ){
42+ try {
43+ return i ;
44+ }finally {
45+ System .out .println (i );
46+ i ++;
47+ System .out .println (i );
48+ }
49+ }
50+
51+
52+ public static void main (String [] args ) {
53+
54+
55+ // try {
56+ // StringBuffer
57+ // testFile();
58+ // } catch (MyException e) {
59+ //// e.getCause().printStackTrace();
60+ // e.printStackTrace();
61+ // }
62+ }
63+ }
You can’t perform that action at this time.
0 commit comments