8-2-6: Consider the following code segment. What is the last row of numbers printed when this code segment is executed?
?
8-2-6: Consider the following code segment. What is the last row of numbers printed when this code segment is executed?
?
Try to guess what the code below will print before running it. Can you get the last element in the nameList to print it out? Can you set the first element in the list to your name and print out the list?
?
Data encapsulation
数据封装:隐藏私有信息。
private access modifier.
私有访问修饰符
object-oriented programming
管理或组织代码的方式
Constructors¶
构造函数
rounds up
四舍五入
binary digits)
二进制数
==
To test if two strings refer to the same object.
y--
y-- == y = y - 1
x++
x++ == x = x+1 == x+= 1
赋值语句¶
变量 = 表达式
Expressions and Assignment Statements¶
表达式和赋值语句
打印变量
变量可以用加号连接
arithmetic expressions.
算数运算式
Relational Operators (<, >)
关系运算符
Compiler
编译器
A basic Java program looks like the following:
基本的Java程序
特殊词(也称为关键字),例如public、class、 和if必须小写,但类名(例如System和 )String要大写。
特殊词小写,类名大写。
特殊词
特殊词
args)
参数