タグ付けされた質問 「type-promotion」

3
「ショート30 = 3 * 10」が正当な割り当てであるのはなぜですか?
が算術演算でshort自動的に昇格さintれる場合、その理由は次のとおりです。 short thirty = 10 * 3; short変数への正当な割り当てthirty? 次に、これ: short ten = 10; short three = 3; short thirty = ten * three; // DOES NOT COMPILE AS EXPECTED これと同様に: int ten = 10; int three = 3; short thirty = ten * three; // DOES NOT COMPILE AS EXPECTED …

3
パラメータでのJavaタイプの昇格
私はこのスニペットを偶然見つけました: public class ParamTest { public static void printSum(int a, double b) { System.out.println("In intDBL " + (a + b)); } public static void printSum(long a, long b) { System.out.println("In long " + (a + b)); } public static void printSum(double a, long b) { System.out.println("In doubleLONG " + (a …
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.