这个课程的参考视频和图片来自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. js 使用a标签 下载资源

    文档 let data = new Blob(['hello ajanuw'], { type: 'application/text' }) let src = window.URL.createOb ...

  2. Diagnostics: File file:/tmp/spark-***/__spark_libs__***.zip does not exist

    Diagnostics: File file:/tmp/spark-c03df206-c90e-4c97-a2d6-a5d3fdb17811/__spark_libs__303213348409500 ...

  3. [No0000DA]WPF ControlTemplate简介

    一.简介 WPF包含数据模板和控件模板,其中控件模板又包括ControlTemplate和ItemsPanelTemplate,这里讨论一下ControlTemplate.其实WPF的每一个控件都有一 ...

  4. 使用flask写移动端API

    环境 python 3.7 使用pip 安装falsk pip3 install flask #!flask/bin/python from flask import Flask, jsonify, ...

  5. FW--tomcat bi-laternal https and keytool

    说明:按照本文中以下内容配置https,猫server.xml中clientAuth=false,单向验证的时候,网页中可以访问:当clientAuth=true进行双向验证的时候,网页中不可以访问: ...

  6. 关于服务器时区BEIST-8、GMT-8、Asia/Shanghai、CST、GMT+8:00等缩写的含义

    http://www.talkwithtrend.com/Article/147961 AIX系统时区总结 字数 2078阅读 5844评论 0赞 0 前几天NTP的问题牵涉出时区问题,大家可能被眼花 ...

  7. LeetCode 427 Construct Quad Tree 解题报告

    题目要求 We want to use quad trees to store an N x N boolean grid. Each cell in the grid can only be tru ...

  8. mysql-5.7免安装版本设置

    mysql-5.7.22 免安装版本设置(Windows7) 一.在Mysql官网下载Mysql-5.7.22的ZIP文件  下载链接为:https://dev.mysql.com/downloads ...

  9. html 标签笔记

    <一.HTML 基础结构> <html>________________________________<head><title>无标题文档</t ...

  10. 洛谷P4570 [BJWC2011]元素 线性基

    正解:线性基+贪心 解题报告: 传送门! 这题其实没什么好写题解的,,,显然贪心一下尽量选魔力大的,不用证明趴挺显然的来着 所以就直接按魔力排个序,插入线性基里面,能插就加个贡献,over 放下代码趴 ...