课程: Java Object-Oriented Programming
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Using classes as blueprints
- [Instructor] Almost anything in real life can be represented in code, but how well something is represented is up to us in what we decide to program. Classes in Java give us a way to model or represent physical objects in code via a blueprint. A blueprint, or class, contains a set of attributes and behaviors that define an object. Let's design a tree object in code using a class. The attributes might be height, trunk diameter, and maybe even tree type. Every tree has these properties or attributes, but their values might not be the same. That's what makes this Class a blueprint. It contains the definition of what a Class should be. As for the behaviors, growing could be a behavior for the tree. It's an action that the tree takes, rather than an attribute representing the current state of the tree. Let's create a blueprint for a tree using a Class in Java. I'm on a Mac, so I'll go ctrl click, and this will allow me to create a new Java Class. We'll call this Tree. And our IDE sets up…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
(已锁定)
Using classes as blueprints4 分钟
-
(已锁定)
Building objects with a constructor2 分钟 48 秒
-
(已锁定)
Using concrete instances for application logic4 分钟 32 秒
-
(已锁定)
Understanding the difference between class and instance members4 分钟 54 秒
-
(已锁定)
Exploring a built-in Java class4 分钟 5 秒
-
(已锁定)
Challenge: Build an employee class1 分钟 8 秒
-
(已锁定)
Solution: Build an employee class3 分钟 11 秒
-
(已锁定)
-
-
-
-
-