提交 96109dfd 编写于 作者: W wizardforcel

2020-07-08 10:07:09

上级 30a12524
......@@ -16,7 +16,7 @@ Kotlin 支持诸如*高阶函数*,*函数类型*和 *lambda* 之类的功能
这些对象具有两个特征:
*
* 状态
* 行为
让我们举几个例子:
......@@ -93,10 +93,10 @@ class Lamp {
其他可见性修饰符是:
* `private`-仅在类内部可见(可以访问)。
* `public`-随处可见。
* `protected`-类及其子类可见。
* `internal`-模块内的任何客户端都可以访问它们。
* `private` - 仅在类内部可见(可以访问)。
* `public` - 随处可见。
* `protected` - 类及其子类可见。
* `internal` - 模块内的任何客户端都可以访问它们。
您稍后将在 [Kotlin 可见性修饰符](/kotlin-programming/visibility-modifiers "Kotlin visibility modifiers")文章中了解`protected``internal`修饰符。
......
......@@ -102,8 +102,8 @@ val marks = 12.3
Kotlin 中的内置类型可以分类为:
* 号码
* 性格
* 数字
* 字符
* 布尔值
* 数组
......@@ -150,7 +150,7 @@ Kotlin 中的数字类似于 Java。 有 6 种内置类型代表数字。
* `Short`数据类型的值可以从 -32768 到 32767(16 位带符号二进制补码整数)。
* 如果可以确定该变量的值在`[-32768, 32767]`之内,则可以使用它代替其他整数数据类型来节省内存。
* 例:
* 例:
```kt
fun main(args : Array<String>) {
......@@ -171,7 +171,7 @@ When you run the program, the output will be:
* * *
* `Int`数据类型的值可以从`-2 ^ 31``2 ^ 31 -1`(32 位带符号的二进制补码整数)。
* 例:
* 例:
```kt
fun main(args : Array<String>) {
......@@ -207,7 +207,7 @@ fun main(args : Array<String>) {
* * *
* `Long`数据类型的值可以从`-2 ^ 63``2 ^ 63 -1`(64 位带符号二进制补码整数)。
* 例:
* 例:
```kt
fun main(args : Array<String>) {
......@@ -241,7 +241,7 @@ val distance = 100L // distance value of type Long
* * *
* `Double`类型是双精度 64 位浮点。
* 例:
* 例:
```kt
fun main(args : Array<String>) {
......@@ -264,7 +264,7 @@ When you run the program, the output will be:
* * *
* `Float`数据类型是单精度 32 位浮点。 如果您有兴趣,请进一步了解[单精度和双精度浮点](http://stackoverflow.com/questions/801117/whats-the-difference-between-a-single-precision-and-double-precision-floating-p)
* 例:
* 例:
```kt
fun main(args : Array<String>) {
......@@ -359,7 +359,7 @@ var letter: Char = 65 // Error
#### `Boolean`
* `Boolean`数据类型有两个可能的值,即`true``false`
* 例:
* 例:
```kt
fun main(args : Array<String>) {
......
......@@ -403,13 +403,13 @@ When you run the program, the output will be:
与 Java 不同,Kotlin 中没有按位和移位运算符。 为了执行这些任务,使用了各种函数(支持中缀符号):
* `shl` - 左移签名
* `shr` - 右移签名
* `shl` - 符号左移
* `shr` - 符号右移
* `ushr` - 无符号右移
* `and` - 按位和
* `or` - 按位或
* `xor` - 按位异或
* `inv` - 按位倒置
* `inv` - 按位反转
访问此页面以了解有关 Kotlin 中[按位运算的更多信息](/kotlin-programming/bitwise "Kotlin Bitwise Operations")
......
......@@ -17,7 +17,7 @@ a ≠ 0
* 如果判别式大于 0,则根是实数且不同。
* 如果判别式等于 0,则根是实数且相等。
* 如果判别式小于 0,则根是复杂且不同的
* 如果判别式小于 0,则根是复数且不同
* * *
......
......@@ -27,8 +27,8 @@ Kotlin is interesting.
### `println()`和`print()`之间的区别
* `print()` - 在引号内打印字符串。
* `println()` - 在引号内打印字符串,类似于`print()`函数。 然后光标移动到下一行的开头。
* `print()` - 打印引号内的字符串。
* `println()` - 打印引号内的字符串,类似于`print()`函数。 然后光标移动到下一行的开头。
* * *
......
......@@ -6,11 +6,11 @@
源代码清单:
+ [使用*,数字和字符打印三角形的代码](#triangle)
+ [代码使用*和数字打印倒三角形](#inverted-triangle)
+ [用于打印完整金字塔的代码](#pyramid)
+ [使用`*`,数字和字符打印三角形的代码](#triangle)
+ [使用`*`和数字打印倒三角形的代码](#inverted-triangle)
+ [打印完整金字塔的代码](#pyramid)
+ [打印帕斯卡三角形的代码](#pascal-triangle)
+ [用于打印弗洛伊德三角形的代码](#floyd-triangle)
+ [打印弗洛伊德三角形的代码](#floyd-triangle)
以下是等效的 Java 代码:[创建金字塔和图案的 Java 程序](/java-programming/examples/pyramid-pattern "Java Program to Create Pyramid and Pattern")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册