[英]Can we instantiate interface nested inside the class in java and why it is different from kotlin?
[英]Can we reference a class from inside a interface?
我們可以從我們的界面引用 class 嗎? 每當我運行代碼時,它都會說 package controller 不存在。 如果給出錯誤為 controller.Tool package 不存在
import controller.Tool;
public interface IRemoteDraw extends Remote {
public void Draw(Tool tool) throws RemoteException;
}
是的。 您可以從接口內部引用 class。 您的類路徑配置為根目錄中沒有名為“控制器”的 package。 因此,第 1 行(導入語句)是一個錯誤,與 rest 無關。
你沒有提供任何進一步的細節; 這使得無法猜測您的類路徑配置錯誤的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.