Documentation

The Java™ Tutorials
Hide TOC
Numbers and Strings数字和字符串
Trail: Learning the Java Language

Lesson: Numbers and Strings课程:数字和字符串

Numbers数字

This section begins with a discussion of the Number class (in the java.lang package) and its subclasses.本节首先讨论Number类(在java.lang包中)及其子类。In particular, this section talks about the situations where you would use instantiations of these classes rather than the primitive data types.特别是,本节将讨论使用这些类的实例化而不是原始数据类型的情况。Additionally, this section talks about other classes you might need to work with numbers, such as formatting or using mathematical functions to complement the operators built into the language.此外,本节还讨论了可能需要处理数字的其他类,例如格式化或使用数学函数来补充语言中内置的运算符。Finally, there is a discussion on autoboxing and unboxing, a compiler feature that simplifies your code.最后,讨论了自动装箱和取消装箱,这是一种简化代码的编译器功能。

Strings字符串

Strings, which are widely used in Java programming, are a sequence of characters.字符串是一个字符序列,在Java编程中被广泛使用。In the Java programming language, strings are objects.在Java编程语言中,字符串是对象。This section describes using the String class to create and manipulate strings.本节介绍如何使用String类创建和操作字符串。It also compares the String and StringBuilder classes.它还比较了StringStringBuilder类。


Previous page: Previous Lesson
Next page: Numbers