一.基本数据类型.常量.变量.运算符
1.数据类型 int. short.char.long.float.double.
2.常量的分类.(1).整型常量 (2)浮点型常量 (3)字符常量 (4)字符串常量.
3.常量的特性:常量存储在常量区,常量区的内容不可被更改.
4.变量的定义与本质.数据类型 变量名 = 初值 . 本质变量就是一个容器....
分类:
移动开发 时间:
2014-12-18 16:59:56
阅读次数:
259
在linux环境下,结构体struct sockaddr在/usr/include/linux/socket.h中定义,具体如下:typedef unsigned short sa_family_t;struct sockaddr { sa_family_t sa_family; /* addres...
分类:
其他好文 时间:
2014-12-18 13:13:14
阅读次数:
170
一般情况下,x+=y与x=x+y输出结果是等价的,因此两种写法是可以通用的,但是在某些临界值选用x+=y更加合适,比如:short n=3;n+=1;//编译通过n=n+1;//编译失败上述例子中,n=n+1等号右侧计算结果为int类型,而左侧变量类型依然是short类型,违反了自动转换规则,需要执...
分类:
其他好文 时间:
2014-12-18 01:30:23
阅读次数:
191
public class Calcsizof {
/**
* @param args
*/
private static void calSize() {
System.out.println("Integer: " + Integer.SIZE/8); // 4
System.out.println("Short: " + Short.SIZE/...
分类:
编程语言 时间:
2014-12-17 22:45:41
阅读次数:
232
java的基本数据类型有8个,分别是boolean,byte,char,short,int,long,float,double, 对应的8个包装类是Boolean,Byte,Character,Short,Integer,Long,Float,Double, 8个包装类除了Character和Int...
分类:
编程语言 时间:
2014-12-16 22:24:13
阅读次数:
209
PHP无限分类[左右值]算法 db=$db;$this->tablefix="om_";} // end func/*** Short description. * 增加新的分类* Detail description* @paramnone* @globalnone* @since1.0* @ac...
分类:
编程语言 时间:
2014-12-16 20:58:53
阅读次数:
328
首先明确这几种数据类的取值范围:byte:-128~127short:-2^15~2^15-1char:0~65536int:-2^31~2^31-1请看以下代码:byteb=100;shorts=b;//正确,因为byte的取值范围在short取值范围之内。charc=b;//错误,因为byte的取值范围不完全在char的取值范围内。c=s;//错误,因为short的取..
分类:
编程语言 时间:
2014-12-15 22:02:11
阅读次数:
633
在程序运行时能够改变的量叫变量。1 定义一个变量 语法:数据类型 变量名 c语言中的数据类型 字符char 短整形short 整形int 长整形long 单精度浮点float 双精度浮点double#includeint main(void){int i;i=12;printf("i=%d",...
分类:
其他好文 时间:
2014-12-14 19:53:42
阅读次数:
149
一 自动类型转换1. 非赋值运算的类型转换 水平方向的转换:所有的 char, short 型自动转换成 int 型,左右的 unsigned short 型自动转换成 unsigned 型,所有的 long 型自动转换成 unsigned long 型,所有的 float 型自动转换成 doubl...
分类:
其他好文 时间:
2014-12-13 12:08:45
阅读次数:
212
今天偶然间发现项目里Integer类型的变量用“==”进行比较的,但是却一直没出现问题。所以就上网查了查,发现这里面涉及到JDK1.5的新特性。1.Java中的数据类型,可分为两类: a.基本数据类型,也称原始数据类型。short,char,int,long,float,double,bool...
分类:
编程语言 时间:
2014-12-12 18:57:00
阅读次数:
146