[英]How to call a method with parameters as objects from another class java?
[英]Java: How to call a method from class from an enumeration of instanced objects?
我在哈希表中創建了幾個對象實例,並希望從每個對象中調用一個方法。
我為此做了一個從所述哈希表檢索的值的枚舉,但是我不確定如何在每個對象上實際調用該方法。
for(Enumeration<Agent> AgentEnum = AgentList.elements(); AgentEnum.hasMoreElements();){
//content+=
AgentEnum.nextElement();
}
內容應收到我試圖從類Agent調用的方法的返回。
content = AgentEnum.nextElement().<your-method>();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.