short res = shortA + shortB导致编译器错误。为什么? [英] short res = shortA + shortB result in compiler error. Why?
本文介绍了short res = shortA + shortB导致编译器错误。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码导致以下编译错误:错误1
无法将类型int隐式转换为short。显式转换
存在(你是否错过演员?)
短a = 1;
短b = 2;
简短结果= a + b;
任何人都可以解释原因吗?
The following code result in the following compilation error: Error 1
Cannot implicitly convert type ''int'' to ''short''. An explicit conversion
exists (are you missing a cast?)
short a = 1;
short b = 2;
short result = a + b;
Can anyone explain why??
推荐答案
1 e 2 sono int。 Prova con:
短a =(短)1;
短b =(短)2;
短结果= a + b;
ny *********** @ gmail.com ha scritto:
1 e 2 sono int. Prova con:
short a = (short) 1;
short b = (short) 2;
short result = a + b;
ny***********@gmail.com ha scritto:
以下代码导致以下编译错误:错误1
无法隐式转换类型''int' ' 太短''。显式转换
存在(你是否错过演员?)
短a = 1;
短b = 2;
短期结果= a + b;
有谁能解释为什么?
The following code result in the following compilation error: Error 1
Cannot implicitly convert type ''int'' to ''short''. An explicit conversion
exists (are you missing a cast?)
short a = 1;
short b = 2;
short result = a + b;
Can anyone explain why??
ny * **********@gmail.com ha scritto:
ny***********@gmail.com ha scritto:
以下代码导致以下编译错误:错误1
无法将类型''int''隐式转换为''short''。显式转换
存在(你是否错过演员?)
短a = 1;
短b = 2;
短期结果= a + b;
有谁能解释为什么?
The following code result in the following compilation error: Error 1
Cannot implicitly convert type ''int'' to ''short''. An explicit conversion
exists (are you missing a cast?)
short a = 1;
short b = 2;
short result = a + b;
Can anyone explain why??
1 e 2 sono interi。 Prova con:
短a =(短)1;
短b =(短)2;
短结果= a + b;
Funziona?
ny *********** @ gmail.com ha scritto:
1 e 2 sono interi. Prova con:
short a = (short) 1;
short b = (short) 2;
short result = a + b;
Funziona?
ny***********@gmail.com ha scritto:
以下代码导致以下编译错误:错误1
无法将类型''int''隐式转换为''short''。显式转换
存在(你是否错过演员?)
短a = 1;
短b = 2;
短期结果= a + b;
有谁能解释为什么?
The following code result in the following compilation error: Error 1
Cannot implicitly convert type ''int'' to ''short''. An explicit conversion
exists (are you missing a cast?)
short a = 1;
short b = 2;
short result = a + b;
Can anyone explain why??
这篇关于short res = shortA + shortB导致编译器错误。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文