-3
我该如何处理这个问题?在java中编写接口
收件的接口名为XYInterface包含两个int常量, X = 5和Y = 10和被叫useXY接收无 参数,并返回一个整数值的方法。 (你并不需要实现 的XYInterfac)
public interface XYInterface {
int x = 5;
int y = 10
}
谢谢。
我该如何处理这个问题?在java中编写接口
收件的接口名为XYInterface包含两个int常量, X = 5和Y = 10和被叫useXY接收无 参数,并返回一个整数值的方法。 (你并不需要实现 的XYInterfac)
public interface XYInterface {
int x = 5;
int y = 10
}
谢谢。
public interface XYInterface {
final int x = 5;
final int y = 10;
static public int useXY() {
return 10; //some integer
}
}
,你可以从任何主类
public class Main {
public static void main(String[] args) {
System.out.println(XYInterface.useXY());
}
}
真棒叫useXY!非常感谢! –
如果答案满足你,你可以将其标记为已接受。 –