Java's 8 basic types and 3 reference types __java

Source: Internet
Author: User
Tags object object

1, the computer's memory unit

The data in the computer is represented by 0 and one, and one of the 0 or 1 is called a bit.

8 bits are called a byte (byte), two bytes are called a word (word), and four bytes are called two-word (Dword).

1byte=8bit, 1kb= 1024 Byte, 1m=1024 KB.

2, Java has four categories of 8 basic types

A, 4 kinds of integral type

BYTE 1 byte

Short 2 bytes

int 4 bytes

Long 8 bytes

B, 2 kinds of floating-point types

Float 4 bytes

Double 8 bytes

C, 1 kinds of truth types

Boolean

D, 1 types of characters

Char

3, Java three types of reference

A, Classes class reference

First, the class

Class

Reference

Can be we created, here I do not say much, mainly to explain a few

Java

Classes in the Library

Object

Object

is a very important class,

Object

is the root class of the class hierarchy, and each class makes the

Use

Object

As a superclass, all objects (including arrays) implement methods of this class. Use

Object

Can

To define all the classes

Such as:

Object object= New Integer (1);

To define a

Interger

Class

Integer i= (integer) object;

Are here to put this

Object

Cast into

Interger

Class

String

String

class represents a String,

Java

All string literal values in the program, such as

"ABC"

) are

Implemented as an instance of this class. Check the individual characters of the sequence, compare strings, search strings, extract

Child

Word

Character

String

Invasive

Built

Word

Character

String

Deputy

This

In

The

Deputy

This

In

The

Yes

Of

Word

Character

are

Be

Turn

Change

For

Big

Write or lowercase form.

Date

Date

Represents a specific moment, accurate to milliseconds.

Date

The classes are generally now

Calendar

And

GregorianCalendar

All replace

Void

Void

A class is a placeholder class that is not instantiated, and it maintains a pair representing

Java

The essential

Word

void

Of

Class

The reference to the object.

Class classes reference can be created by us, here I do not say much, mainly to explain a few Java library class Object:object is a very important class, Object is the class hierarchy of the root class, each class uses Object as a superclass, All objects, including arrays, implement methods of this class. Object can be used to define all classes such as: Object object= new Integer (1);     To define an Interger class integer i= (Integer) object; To cast this object into the Interger class String:string class represents a string, all string literals in the Java program (such as "ABC") are implemented as instances of this class.   Checks a single character of a sequence, compares a string, searches a string, extracts a substring, creates a copy of a string, and in that copy, all characters are converted to uppercase or lowercase. Date:date represents a specific moment, accurate to milliseconds.
The class of date is generally now all replaced by calendar and GregorianCalendar. The Void:void class is a placeholder class that is not instantiated, keeping a reference to a class object that represents the Java keyword Void.
  also has a corresponding class such as: Integer  long  boolean  byte  character  double  float   short& nbsp          &NBSP;B, Interface interface reference     Interface interface Reference   can be we created, here I don't say much, The main is to explain several Java Library interface interface  list<e&gt: List, users of this interface can accurately control the insertion position of each element in the list. The user can access the element based on the integer index of the element   (position in the list) and search for the elements in the list. The List interface provides two ways to search for a specified object. From a performance standpoint, these methods should be used with care. In many implementations, they perform high overhead linear searches. The list interface provides two   ways to efficiently insert and remove multiple elements at any location in the list.  add (): Inserts the specified element in the list.  remove (): Removes the element from the specified position in the list.  get (int index): Returns the element at the specified position in the list.     MAP&LT;K,V&GT:   K-the type of the key maintained by this mapping   V-the type of the mapped value maps the key to the value's object. A map cannot contain duplicate keys, and each key can be mapped to at most one value.   Put (K key,v value): Associates the specified value with the specified key in this map (optional action). If this mapping previously contained a mapping relationship for the key, the old value is replaced with the specified value (if and only if true is returned, the mapping m contains the mappings of the key K).  remove (Object key) If a mapping relationship exists for a key, it is removed from this map (optional operation). Rather, if this map contains a mapping relationship from key k to value V satisfying (key==null k==null:key.equals (k)), the mapping relationship is removed. (This mapping can contain at most one such mapping relationship.) Get (Object Key): Returns the value mapped by the specified key, or null if the mapping does not contain a mapping relationship for the key.   Here we mainlyis a string List Map Object is the most commonly used number arraylist<e> arrays   can be traced to the JDK API   These classes and interfaces in Java.lang: providing access to Java programming languages The basic class for programming.     Java.unit: Contains the collection framework, legacy collection classes, event models, date and time facilities, internationalization, and various utility classes (string tag builder, random number generator, and bit array).     


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.