- 7
- 0
- 约5.11千字
- 约 5页
- 2020-07-16 发布于江苏
- 举报
Chapter 8 Objects and Classes
See the section Defining Classes for Objects.
The syntax to define a class is public class ClassName {
}
The syntax to declare a reference variable for an object is
ClassName v;
The syntax to create an object is
new ClassName();
Constructors are special kinds of methods that are called when creating an object using the new operator.
Constructors do not have a return type —not even void.
A class has a default constructor only if the class does not define any constructor.
The member access operator is used to access a data field or invoke a method from an object.
A
原创力文档

文档评论(0)