æé»åå¤æã®é©ç¨æ¡ä»¶
以ä¸ã®ããã°ã©ã ã®åºåçµæãã©ããªãããèªä¿¡ãæã£ã¦çãããã¾ããã§ããã
public class Test { static void print(short n) { System.out.println("short"); } static void print(int n) { System.out.println("int"); } static void print(float n) { System.out.println("float"); } static void print(double n) { System.out.println("double"); } public static void main(String[] args) { byte b = 0; print(b); char c = 'a'; print(c); long l = 0l; print(l); } }
ãã®è¾ºã¯åºæ¬ä¸ã®åºæ¬ãªã®ã«ãä»ã¾ã§ç解ãé©å½ã ã£ããªã¼ã¨åçã確èªãã¦ã¿ãã¨ãããæé»ã®åå¤æã¯æ¬¡ã®ã«ã¼ã«ã«å¾ããã¨ãåããã¾ããã
- byte
- short
- (char)
- int
- long
- float
- double
- çªå·ã®å°ããåãã大ããåã«åãã£ã¦ãæé»åå¤æãæå¹ããã ããcharã¸ã®å¤æã¯ä¸å¯ã
- çªå·ã®å¤§ããåããå°ããåã¸ã¯æ示çãªãã£ã¹ããå¿ è¦ã
- å¤æã®é©ç¨åªå é ä½ã¯ãçªå·ã®é çªã«å¾ããä¾ãã°ãbyteâintãããbyteâshortãåªå ãããã
ãã£ã¦ãåé ã®ããã°ã©ã ã®åºåçµæã¯
short int float
ã¨ãªãã¾ãã