小编use*_*ser的帖子

如何使用界面铸造?

为什么会出现以下输出/错误?

public class A1 {
    public void bar() {
        System.out.println("A1 bar");
    }

    public static void main(String[] args) {
        List<A1> list = new ArrayList<>();
        list.add(new B());
        /* add the missing lines here*/
    }
}

public interface A2 {
      void foo(List<A1> list, int idx);
} 

public class B extends A1 implements A2 {
    public void foo(List<A1> list, int idx) {
        A1 a1 = list.get(idx);
        if (a1 instanceof B) {
            System.out.println("It's a B!");
        } else {
            a1.bar();
        }
    }

    public void bar() { …
Run Code Online (Sandbox Code Playgroud)

java casting interface

1
推荐指数
1
解决办法
64
查看次数

如何使用宏?

为什么答案是a = 71?为什么不运行这个程序结束时答案是:m1(3,2,1)= 7 .... a = m2(7,21,14)= 7*21 + 14

#define m1(a,b,c) a*b+c
#define m2(x) m1( (x), (x*3), (x*2))

int main()
{
   int a;
   a=m2(m1(3,2,1));
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

c macros function

-2
推荐指数
1
解决办法
77
查看次数

标签 统计

c ×1

casting ×1

function ×1

interface ×1

java ×1

macros ×1