2024年5月19号

Core: Visibility Modifiers

At this point we've been talking about what's inherited? 

We've used the terms private and public and those visibility modifiers impact what gets inherited from one class to another. 

What we're gonna do now is spend a little more time looking 

at the different visibility modifiers and how they impact us. 

Particularly in relation to inheritance.

By the end of this video, you should be able to use the appropriate visibility 

modifiers when you're writing your class.

in the title, let me explain each word Visibility Modifiers

Visibility means the acess to domains

Modifiers are these four words in this context, they are public,protected,package,private

there are two domains:

package

class

there are three ways to control domain of variable acess:

they are 

public : no control to any domain

protected : within the same package and sub class

packaged : within the same package

private : within the same class

Core: Object Creation in Java

what we're gonna do next is look at object construction in Java. 

Now, you've already reconstructed before, so you might say, 

well, wait a second why are we revisiting this? 

Well, the reason we're revisiting this is because now we know inheritance, 

we now know some more details about how objects actually get constructed.

look at how Java actually constructs or initializes its objects really from the inside out. And a second piece to this is once given that space, pass a reference to that space to the constructor for initialization.

In fact constructors really should be called Initializers, and you'll see in other programming languages that they're actually called init.

So really what the student constructor does is just initialize the variables associated with student. 

And the way that's gonna do this is essentially from the inside out.

you create the space for the object

then you pass that space to the student constructor

  • 17
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值