[問題] Java 程式中怎麼讓名稱前後一起變

看板java作者 (自信始終來自於人心)時間16年前 (2009/06/29 21:17), 編輯推噓1(105)
留言6則, 5人參與, 最新討論串1/1
Client.Medicationservice serviceLocator = new MedicationClient.MedicationserviceLocator(); 其中等於前面的Medicationservice跟等於後面的MedicationserviceLocator()會改變 要如何讓他在程式中是變動的 舉例好了 舉例1 Client.XYZservice serviceLocator = new MedicationClient.XYZserviceLocator(); 舉例2 Client.ASDservice serviceLocator = new MedicationClient.ASDserviceLocator(); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.72.32

06/29 21:24, , 1F
eclipse, shift+alt+r XD
06/29 21:24, 1F

06/29 21:33, , 2F
NetBeans : 框變數 -> 右鍵 -> Refactor -> Rename
06/29 21:33, 2F

06/29 21:34, , 3F
框變數 -> Ctrl+R
06/29 21:34, 3F

06/29 23:08, , 4F
->不懂耶
06/29 23:08, 4F

06/30 00:36, , 5F
為什麼我覺得原po想要的是可以依照類別去new出來用?
06/30 00:36, 5F

07/02 16:23, , 6F
我猜,你需要多型與Reflection來解決你的問題
07/02 16:23, 6F
文章代碼(AID): #1AIBxlCy (java)