这个课程的参考视频和图片来自youtube

主要学到的知识点有:

  • Define a method:(motivation: write one time, but use it many times)

  1. Access: public, private, protected
  • public: Any other class can access a public field or method. (Further, other classes can modify public fields unless the field is declared as final.)
  • private: Only current class can access.
  • protected: Accessible within all classes in the same package and within subclasses in other packages.

    2. Declaration: static

  • static: methods can be called without declaring an object of the class first.

    3. Return type: void, int, double, char, String, boolean.

  • void: the method has no return value.

    4. Method name:

  • Good name rule: Spell out things where possible

    Lower case, second work on is capitalized, e.g.
    thisIsAFunction()

    5. Parameters:

  • Variable Scope Rule:  Variable or method parameter only exists inside the method body.
  • When pass the parameters, only pass the value. That is why when we declare a field in a class, will start with "_", to distinguish variables with the local variable here.
  • Good paramether name rule: Spell out things where possible

    Lower case, second work on is capitalized, e.g.
    numberRuns

  • If it is final : All caps with underscores, e.g.
    THIS_IS_A_CONSTANT

    6. Method body:

  • in the block { ... }
  • Good block format rule : Indent at 3 space

More rules about naming and format, can refer [Java] public, private, final and basic rules for naming.

[Java in NetBeans] Lesson 05. Method/function的更多相关文章

  1. [Java in NetBeans] Lesson 07. JavaDoc and Unit Tests

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. organize code into packages Create a package if want to make th ...

  2. [Java in NetBeans] Lesson 00. Getting Set-up for Learning Java

    这个课程的参考视频在youtube. 主要学到的知识点有: set up needs Java SE JDK, NetBeans IDE class name should be the same l ...

  3. [Java in NetBeans] Lesson 15. Sorting and Searching.

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Build in functions in java.util.Collections Need to implement a co ...

  4. [Java in NetBeans] Lesson 06. Custom classes

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Constructors: A special method called when an object of the class ...

  5. [Java in NetBeans] Lesson 04. Class / Objects

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Class: Blueprint for an object. (e.g. dog is a class) Object: cust ...

  6. [Java in NetBeans] Lesson 01. Java Programming Basics

    这个课程的参考视频在youtube. 主要学到的知识点有: Create new project, choose Java Application. one .jar file/ package(.j ...

  7. [Java in NetBeans] Lesson 17. File Input/Output.

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...

  8. [Java in NetBeans] Lesson 16. Exceptions.

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...

  9. [Java in NetBeans] Lesson 09. Switch / If-Else Ladder

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Nested If-else statement (if-else ladder) /** * 90 and above == ...

随机推荐

  1. easyui---修改删除查询

    修改:在toolsbar 修改工具中 { text:"编辑用户", iconCls:"icon-edit", handler:function(){ var s ...

  2. MySQL+Amoeba实现数据库读写分离

    参考:https://www.cnblogs.com/liuyisai/p/6009379.html 一,Amoeba是什么 Amoeba(变形虫)项目,专注 分布式数据库 proxy 开发.座落与C ...

  3. eclipse搭建j2ee

    Tomcat环境变量设置,分别添加3个系统变量 CATALINA_BASE E:/tomcat7 CATALINA_HOME E:/tomcat7 CATALINA_TMPDIR Etomcat7/t ...

  4. Codeforces 1132C - Painting the Fence - [前缀和优化]

    题目链接:https://codeforces.com/contest/1132/problem/C 题意: 栅栏有 $n$ 个节,有 $q$ 个人可以雇佣来涂栅栏,第 $i$ 个人可以涂第 $l_i ...

  5. POJ 1063 - Flip and Shift

    Description This puzzle consists of a random sequence of m black disks and n white disks on an oval- ...

  6. 1.7Oo局部变量和成员变量执行顺序

    import java.util.Scanner; public class booleann { private float fWidth; private float fHeight; void ...

  7. CM5.x配置spark错误解决

    通过cloudera manager 5.x添加spark服务,在创建服务过程中,发现spark服务创建失败,可以通过控制台错误输出看到如下日志信息: + perl -pi -e 's#{{CMF_C ...

  8. [Day1]常用Dos命令,Java相关描述及基础

    1.常用的DOS命令 (1)返回上一级目录:cd.. (2)返回盘符根目录:cd\ (3)切换当前盘符:   盘符: (4)进入文件夹:       cd 文件路径 (5)展示当前目录下的所有内容:D ...

  9. [tcpreplay] tcpreplay高级用法--使用tcpreplay-edit进行循环动态发包

    tcpreplay-edit提供了可对包进行修改的高级用法: --unique-ip Modify IP addresses each loop iteration to generate uniqu ...

  10. 4QC(四象限变流器)

    1.什么是4QC? 4QC又叫四象限整流器 它是全控型晶闸管的整流电路,现在一般用水冷的IGBT组成的整流电路,它可以调节电压和电流,所谓的四象限就是 u+,i+,为第一象限: u-,i+.,为第二象 ...