두 번째 연구의 자바 장에서 생각

이 책의 자바 저자의 생각은 장의 내용에 대해 알아 보려면이 장에서 운동을 이해하기 쉬운 단어 자바 관련 지식을 소개하고, 마지막으로이있을 것이다. 해적이 운동은 나에게 성취감뿐만 아니라, 자신의 학습 콘텐츠의 긍정을 제공합니다.

예를 들어, 인쇄물의 코드를 다음과 같은 몇 가지 코멘트 문은 쉽게 이해할 수 있습니다 :

Public 클래스 Practice06 { 
정적 클래스 StaticTest {
정적 INT I = 48;
}
정적 클래스 Incrementable {
정적 무효 증가 () {
StaticTest.i ++;
}
}
공용 정적 클래스 ITest {
공공 정적 무효 메인 (문자열 []를 인수) {
에서 System.out.println ( "StaticTest.i ="+ StaticTest.i);
StaticTest ST1 = 새로운 StaticTest ();
StaticTest ST2 = 새로운 StaticTest ();
에서 System.out.println ( "st1.i ="+ st1.i);
에서 System.out.println ( "st2.i ="+ st2.i);
그것은 새로운 Incrementable을 () = Incrementable;
it.increment ();
에서 System.out.println ( "it.increment () 메소드가 호출된다 :");
에서 System.out.println ( "st1.i ="+ st1.i)
에서 System.out.println ( "= st2.i" st2.i +),
() Incrementable.increment
"Incrementable.increment (메소드에서 System.out.println (호출 된 이후) :")
에서 System.out.println ( "st1.i ="+ st1.i);
에서 System.out.println ( "st2.i ="+ st2.i);
}
}
}
================== 분리선 ========= ==========
Public 클래스 Practice10 { 
공공 정적 무효 메인 (문자열 []에 args) {
AllTheColorsOfTheRainbow 법 새로운 AllTheColorsOfTheRainbow = ();
에서 System.out.println ( "act.anIntegerRepresentingColors ="+ act.anIntegerRepresentingColors);
act.changeColor (7);
act.changeTheHueOfTheColor (77);
에서 System.out.println ( "颜色改变后, act.anIntegerRepresentingColors ="+ act.anIntegerRepresentingColors);
에서 System.out.println ( "act.hue ="+ act.hue);
}
}
클래스 AllTheColorsOfTheRainbow {
INT anIntegerRepresentingColors = 0; //用基本类型来代表颜色
INT 색조 = 0;
changeTheHueOfTheColor을 (newHue를 INT) 무효화 {
색조 = newHue;
}
지능 changeColor이 (INT newColor) {
anIntegerRepresentingColors = newColor를 반환;
}
}
이 책의 연습의 대부분은 그들의 노력이 헛되지 않은 느낌이 후 성공적으로 실행하기 위해 자신의 코드를 작성, 장이, 코드 모핑 이상에서 나타났다 단계적으로있다, 아니, 23만3천3백33일 "BUG"를 노크

추천

출처www.cnblogs.com/yyslif/p/11122471.html