Android開發筆記(5)——方法調用(基礎),android筆記

來源:互聯網
上載者:User

Android開發筆記(5)——方法調用(基礎),android筆記
轉載請註明——部落格園igoslly:http://www.cnblogs.com/igoslly/p/6833544.html
 在實際方法調用中,程式按順序逐句執行,直到“}”結束。為避免程式大量重複的代碼(如相同的布局設定、相同的功能),往往將重複的代碼定義為新的方法,如display()、displayPrice(),在原主體方法中我們只需進行調用即可。執行順序如下:
1、定義方法 調用範圍:

public 公用函數

  可以被任意調用

private 私人函數

只能在定義函數體、定義類中使用
  不存在輸入參數時:
public int calculate()

 

不存在輸出參數時

public void calculate(int quantity, int price)

 

 

申明:

1、本筆記為文字及圖片均為個人原創,轉載請註明部落格園-igoslly

2、Android開發課程於2017年4年參與GoogleDeveloper進行學習,筆記原版http://www.studyjamscn.com/thread-20580-1-1.html#pid272486

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.