# 9/8 K速記 * 內部類別 * 需有外部類別的實體 才能使用內部類別 * 或 將內部類別作為 靜態Static 則可 [ new 外部類別.內部類別(); ] 方式建立 * 內部類別 可存取外部類別所有屬性的資料,但仍有 實體存在等相關限制 * 外部類別的屬性 需有實體存在才能被內部取得,但內部通常要求引述函數為final修飾詞 * 內部類別 調用外部類別屬性 * 使用 外部類別.this.屬性 可存取外部類別屬性 * 使用 this.屬性 取得內部類別實體的屬性 * => this 指向 當前類別實體 ## 工程師 職務劃分 * 大數據 => 數據分析師( Matlab / R ) (台灣薪水 不高) * AI => 人工智慧演算法工程師 ( 國外最高有 一億 / 台灣不重視 40W/Y / 博弈 數學模型 薪資高) * 資安 => 難度高 薪水高 cisco認證 軟~硬都要會 * ==== 以上與軟體工程師 較無直接關聯 ========================================== * 後端: (起薪與IOS/Android差不多,一般薪資大約可到8萬 最高有25萬 歷屆學長有 6個月到6萬 2年~8萬) * nodejs * java spring * dotnet * dotnet core(微軟出的) * php * ruby * python.. go.. etc. * 前端: * IOS (obj-c/swift) * Android (java/kotlin) * web (vue/react/angular) (目前台灣太多人拉低) js/ts,html/pug > 35K以下 請勿接受 拖低薪資水平 請勿當敗類 > 歷屆 前8名 薪資水準都屬於高的 >假日通常 念書 或 寫code > ## 內部類別(續) * 在內部增加介面,在外面建立實際類別來 impelememts 該方法, 將程式彈性保留在外部, * 如 在StudentArr的類別內 建立 內部類別(Interface) 如comparator, * 作為理想的程式結構 會使用到comparator功能 但僅保留介面,使其在外部實現。 ## Builder Pattern 用來處理多載建構子(有參數限制) ```java public calss Test{ public static calss Builder{// 必須為靜態方法 private int a; private int b; private int c; public Builder setA(int a){ this.a = a; return this; } public Builder setB(int b){ this.b = b; return this; } public Builder setC(int c){ this.c = c; return this; } publis Test gen(){ return Test(this.a,this.b,this.c); } } private Test(test a,test b, test c){//使用 private屬性 ,只讓builder來產生建構子的方式 } } ``` ```java= public static void main(String[] args){ Test t = new Test.builder() .setA(4) .setC(7) .gen() } ``` ## 匿名內部類別 (java 8 之前) 主程式內 創建內部interface 或引入介面時 在主程式內 可直接new出 ```java= final Student s1 = new Student(1,1,""); StudentArr.Filter filter = new StudentArr.Filter(){ @Override public boolean filter(Student student){ System.out.print(s1); return student.getSeat() < 10; } } ``` ## -> (lunda) 當介面 只有一個方法時 (java 8之後 可取代匿名內部類別) ```java= final Student s1 = new Student(1,1,""); StudentArr.Filter filter = (Student student) ->{ return student.getSeat() < 10; } } ``` ## 當lunda內容 只有回傳值(一行) 可再次進行省略 ```java= final Student s1 = new Student(1,1,""); StudentArr.Filter filter = (Student student) -> student.getSeat() < 10; ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up