OOP(object-oriented programming):
object: a repository of data;
class: type of object.
method: procedure of function that operates on objects or class.
Inheritance: A class may inherit properties from a more general class.
Polymorphism: one method works on several class, even if the class need different implementations.
object-oriented: each object knows its own class & methods.
Java
variable: you must
declare them and their
type.
eg: int x; <——java does 2 things:①allocate memory to store an integer, type int. ②names variable “x".
variable also used to
reference objects.
2 ways

本文介绍了面向对象编程的基础概念,包括对象、类、方法、继承和多态。详细阐述了Java中的变量声明、对象创建过程,特别是字符串对象的特性和构造器的使用。同时,讲解了Java程序的编译与运行流程,并通过实例展示了如何使用System类进行简单的输入输出操作。
最低0.47元/天 解锁文章
339





