Java的数据类型.PPT

  1. 1、本文档共56页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Java的数据类型

Java程序设计 Java Programming Spring, 2013 Contents (Chapter 6 in Textbook) Data Types(数据类型) Operators(运算符) Expressions(表达式) Arrays(数组) 包装器类 字符串类 名字含义 控制流语句 Data in Java Java is a “typed” language(强类型语言): Every data value must have a type; The type gives rules for what values are allowed, and what operations can be done with the values. For the computer, values of a certain type usually take a known amount of storage space in memory. Data in Java Primitive data types(基本数据类型) A primitive type represents a single value, which cannot be decomposed. Reference data types(引用数据类型) The reference(引用) types are class(类) types interface (接口) types array(数组) types Variables of these types can refer to objects(指向对象) of the corresponding type. Java的数据类型 Primitive Data Type Java has a number of pre-defined primitive data types. boolean Boolean (logical) values, either true or false char 16-bit single character byte 8-bit integers (signed) short 16-bit integers (signed) int 32-bit integers (signed) (e.g. 3) long 64-bit integers (signed) float 32-bit floating point double 64-bit floating point (e.g. 3.0) Type Boolean A Boolean variable is one which can have only 2 possible values: true or false. Boolean variables are used when you need to do logical tests Example: “Is X greater than 3?” x 3 Type int(整数) A variable of type int may take values from –2147483648 to 2147483647. Exceeding the range of legal values results in OVERFLOW(溢出), a run-time error. Base of the number: octal(8进制) — a leading 0(zero) hexadecimal(16进制) — a leading 0x or 0X decimal(10进制) Type long(长整数) A variable of type long may take values from –9223372036854775808L to 9223372036854775807L. To indicate the difference between an int constant and a long constant, the character “L/l “ is appended. Example: 2 is of type int 2L is of type long Type float(单精度浮点数) float :4个字节,32位 从1.40129846432481707e-45到 3.40282346638528860e+38 (正值或负值的绝对值) 数字后必须用f指明,否则属于double型。 Type double (双精度浮点数) Typ

文档评论(0)

youbika + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档