zoukankan      html  css  js  c++  java
  • 【笔记】Eclipse and Java for Total Beginners—002

    Lesson 02 – Add Methods To Class

    • Introduce Eclipse Views and Perspectives
    • Introduce Eclipse user interface – drag / drop, cnntext menus, help
    • Add get and set methods to Person class

    1. 自动提示或补充标识符。

        英文版的系统用Ctrl+Space, 中文版的系统用Alt+/。

    2. Parameters and Fields.

    3. this

        this = the current object

    4. Class members

        1> Fields for data.

        2> Constructors to create objects.

        3> Methods. e.g.. getters , setters.

    1 package org.totoalbeginner.tutorial;
    2
    3  public class Person {
    4
    5 // fields
    6   private String name; // name of the person
    7   private int maximumBooks; // most books the person can check out
    8
    9 // constructors
    10   public Person() {
    11 name = "unknown name";
    12 maximumBooks = 3;
    13 }
    14
    15 // methods
    16   public String getName() {
    17 return name;
    18 }
    19
    20 public void setName(String anyName) {
    21 name = anyName;
    22 }
    23
    24 public int getMaximumBooks() {
    25 return maximumBooks;
    26 }
    27
    28 public void setMaximumBooks(int maximumBooks) {
    29 this.maximumBooks = maximumBooks;
    30 }
    31
    32
    33
    34 }

  • 相关阅读:
    ABP源码分析四十:ZERO的Application和Tenant
    ABP源码分析三十九:ABP.Hangfire
    ABP源码分析三十八: ABP.Web.Api.OData
    ABP源码分析三十七:ABP.Web.Api Script Proxy API
    232. 用栈实现队列
    155. 最小栈
    725. 分隔链表
    328. 奇偶链表
    148. 排序链表
    143. 重排链表
  • 原文地址:https://www.cnblogs.com/halflife/p/2076409.html
Copyright © 2011-2022 走看看