Data Types in Java

In Java, Data types are classified into two categories:

1. Primitive Data Type

2. Non-Primitive Data Type

there are 8 primitive data types:

char  boolean  byte  short  int   long   float  double

8 primitive can be classfiied into 4 groups;

group 1: Integer

byte : It is 8 bit integer data type. Value range from -128 to 127. Default value zero. example: byte b=10;

short : It is 16 bit integer data type. Value range from -32768 to 32767. Default value zero. example: short s=11;

int : It is 32 bit integer data type. Value range from -2147483648 to 2147483647. Default value zero. example: int i=10;

long : It is 64 bit integer data type. Value range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Default value zero. example: long l=100012;

group 2: Floating-Point Number

float : It is 32 bit float data type. Default value 0.0f. example: float ff=10.3f;

double : It is 64 bit float data type. Default value 0.0d. example: double db=11.123;

group 3: characters

char : It is 16 bit unsigned unicode character. Range 0 to 65,535. example: char c=‘a‘;

group 4: boolean

This group represent boolean, which is a special type for representing true/false values. They are defined constant of the language. example: boolean b=true;

2) Non-Primitive (Reference) Data Type:

A reference data type is used to refer to an object. A reference variable is declare to be of specific and that type can never be change. We will talk a lot more about reference data type later in Classes and Object lesson.

时间: 2024-07-31 14:32:39

Data Types in Java的相关文章

Core Java Volume I — 3.3. Data Types

3.3. Data TypesJava is a strongly typed language(强类型语音). This means that every variable must have a declared type(每个变量都必须声明类型). There are eight primitive types in Java(Java有8种原始类型). Four of them are integer types; two are floatingpoint number types;

Data Types

原地址: Home / Database / Oracle Database Online Documentation 11g Release 2 (11.2) / Database Administration Data Types Each value manipulated by Oracle Database has a data type. The data type of a value associates a fixed set of properties with the va

Oracle Schema Objects——Tables——Oracle Data Types

Character Data Types 字符数据类型 Character data types store character (alphanumeric) data in strings. 字符数据类型存储在字符串中的字符 (字母或数字) 数据. The most commonly used character data type is VARCHAR2, which is the most efficient option for storing character data. 最常用的字

高性能MySQL笔记-第4章Optimizing Schema and Data Types

1.Good schema design is pretty universal, but of course MySQL has special implementation details to consider. In a nutshell, it’s a good idea to keep things as small and simple as you can. MySQL likes simplicity, and so will the people who have to wo

【翻译】苹果官网的命名规范之 Naming Properties and Data Types

苹果官方原文:Naming Properties and Data Types 前言:纯属练习英语和学习.翻译错误和不通顺的地方敬请谅解和指正.O(∩_∩)O 属性和数据类型的命名 本节讲述了属性定义.变量.常量.通知和异常的常用命名规范. l 定义属性和变量 一个属性定义会影响该属性的访问方法的定义.所以属性的命名规范大体上和访问器(getter,setter)的命名规范是一致的.如果一个属性是表达一个名词或者动词,那么定义如下: @property(…) type nounOrVerb 例如

VHDL之User-defined data types

VHDL allows the user to define own data types. 1 user-defined integer types -- This is indeed the pre-defined type integer type integer is range -2147483647 to +2147483647; -- indeed the pre-defined type natural type natural is range 0 to +2147483647

Data Types in the Kernel <LDD3 学习笔记>

Data Types in the Kernel Use of Standard C Types /* * datasize.c -- print the size of common data items * This runs with any Linux kernel (not any Unix, because of <linux/types.h>) * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyr

【12c】扩展数据类型(Extended Data Types)-- MAX_STRING_SIZE

[12c]扩展数据类型(Extended Data Types)-- MAX_STRING_SIZE 在12c中,与早期版本相比,诸如VARCHAR2, NAVARCHAR2以及 RAW这些数据类型的大小会从4K以及2K字节扩展至32K字节.只要可能,扩展字符的大小会降低对LOB 数据类型的使用.为了启用扩展字符大小,你必须将MAX_STRING_SIZE的初始数据库参数设置为EXTENDED. 要使用扩展字符类型需要执行以下过程: 1.关闭数据库 2.以升级模式重启数据库3.更改参数: ALT

Data Types in the Kernel &lt;LDD3 学习笔记&gt;

Data Types in the Kernel Use of Standard C Types /* * datasize.c -- print the size of common data items * This runs with any Linux kernel (not any Unix, because of <linux/types.h>) * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyr