![](/img/trans.png)
[英]How do you call this kind of concurrency related class? And is there a standard implementation?
[英]How do you call this kind of assignment : float aFloat = 4.f;
我想知道你怎么稱呼它,我想到了“隱式數據類型”,但似乎這真的不是我想象的那樣。
我也想知道 Java 中的所有可能性,就像我知道你可以為其他數值做它,比如字節、整數、長整數等。我自己搜索但我仍然不知道如何定義這個一種數值變量賦值,或者如何命名它。
我只是對此感到好奇,但我仍然很想知道!
提前致謝。
在您的示例中,它確實不是“隱式”的。 恰恰相反。
以下是官方Java 教程中有關原始類型及其符號(下面粘貼的示例)的更多信息,以及您需要了解的有關浮點數的一些技巧。
您可能還想了解更多關於轉化、促銷和窄選的信息。
int decVal = 26; // The number 26, in decimal
int octVal = 032; // The number 26, in octal
int hexVal = 0x1a; // The number 26, in hexadecimal
int binVal = 0b11010; // The number 26, in binary
double d1 = 123.4;
double d2 = 1.234e2; // same value as d1, but in scientific notation
float f1 = 123.4f;
使用下划線(自 Java 7 起)
long creditCardNumber = 1234_5678_9012_3456L;
long socialSecurityNumber = 999_99_9999L;
float pi = 3.14_15F;
long hexBytes = 0xFF_EC_DE_5E;
long hexWords = 0xCAFE_BABE;
long maxLong = 0x7fff_ffff_ffff_ffffL;
byte nybbles = 0b0010_0101;
long bytes = 0b11010010_01101001_10010100_10010010;
我同意 haylem,這不是隱含的。
您要求提供其他數字類型示例:
Integer 類型:
073 (leading zero, octal)
123l (long)
0xFF (hex)
浮點:
1.1E-3 (double)
1e10f (float)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.