Java-自学笔记-5

24 篇文章 0 订阅
24 篇文章 0 订阅

Java自学-5

说说“some terminologies”

Instance variable

也就是我们常说的“实例变量”,可以设定对象的特征等。

Constructor

在网上看主要翻译为“构造器”?它类似于一种method但是实际并不是method,它决定了怎样去实例化一个类,不确定自己翻译的对不对,还是上英文吧(Determines how to instantiate the class)

Non-static method or Instance Method

如果一个方法会通过一个类的实例来触发,那么这个方法一定就是non-static的了。举个例子
一个方法中给出了几个数据段对应的不同响应,类似于我有3块钱,可以买瓶水;我有5块钱,可以买根烤肠。。。这种需要考虑到“我”的具体情况对应的方法,就一定是非静态的了。

Declaration Instantiation and Assignment

声明、实例化以及分配,这三个术语感觉放在一起说更易理解和记忆一些,举个例子来说吧:

/*if I have a class called Dog*/
Dog smallDog;  //this is a declaration, define a smallDog, it has the properties of the Dog class
new Dog(20);    //this is a instantiation, it's means that I creat a new Dog class with some settings
Dog smallDog = new Dog(20);  //this code contains declaration iinstantiation and assignment, it is the most popular way as well

Invocation

调用,也就是调用其他class中的method,还说dog的例子吧:

smallDog.makeNoise();  //assume we have a method in Dog class called makeNoise, we want to use it in my new class - smallDog, I'll write this code and make it.

英语水平很一般很一般,注释凑活写的英文的被嫌弃就好~

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值