基本数据类型,代码实际操作
2015-12-02 18:05
531 查看
package hello; public class string { public static void main(String[] asdf){ int i; i = 123; int m=1,n=2,x=3,y=4; final double PAI= 3.1415926; //pai = 3.14;常量只能赋值一次 常量命名一般是全大写PAI String Strname = "TOM住在这个房间"; System.out.println(Strname); Strname = "张三住在这里"; System.out.println(Strname); System.out.println(i); System.out.println(m); System.out.println(n); System.out.println(x); System.out.println(y); byte b=127;//超过127就会报错 最大值 byte a=-128;//超过128就会报错 最大值 short s = 2; int c = 123; long l = 1234L;//后边加L强制转化成long型 int w= (int)1234L;//强制转换成int型 float f = 123.45f;//默认不可以的 机上F就可以了 double d=123.45; f=(float)d; System.out.println(f); char cc='a';//只能是单引号 引起的单个字符 int aa=cc; System.out.println("aa="+aa); char bb = 98; System.out.println("bb="+bb);//ASCII码, boolean t=true; t=false; } }
相关文章推荐
- 01-2安装离线springsource-tool-suite的时候非常缓慢问题解决方案
- python FTP上传和下载文件
- Springfox swagger-ui 覆盖默认request host
- C语言编程中的联合体union入门学习教程
- rrdtool 修改水印logo
- java解析中国行政区域并在页面显示实现动态逐级筛选
- JAVA代码 运算符
- 【python】正则表达式-常用函数
- C++中纯虚函数与虚函数的作用和区别
- 01-SpringMVC-HelloWorld
- PHP求周岁
- PHP加密扩展 (php-beast) 1.5版本 常见问题解答
- python glob 模块 map函数
- Qt之SQL数据库
- 简单介绍python-nmap 模块的使用
- 第三方包jintellitype实现Java设置全局热键
- java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to java.lang.RuntimeException
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
- 怎样在DELPHI中使用API函数
- Windows Azure Web Site (11) 使用源代码管理器管理Azure Web Site