java int转short

2025-02-27 16:56:29
推荐回答(3个)
回答1:

你好,
public static void main(String[] args) {
// TODO Auto-generated method stub
int a = 9;
short b = (short) a;
System.out.println(b);
}

回答2:

a=(short) (a);

回答3:

int i=2
short s=(short)i;