劉任昌,w3schools,陣列array,方法length,迴圈for-each
w3schools學習:陣列array,方法length,迴圈for-each
/* 劉任昌2022.11.7.w3schools,陣列array,陣列長度方法length,陣列是在型態後面加[] corner bracket */
public class Main {
public static void main(String[] args) {
String[] hey = {"富豪", "寶馬", "福特", "馬自達","撈屎來食","瀕死"};
System.out.println(hey.length);
/* 方法,函數, length陣列長度 */
/* 迴圈輸出陣列 hey*/
for ( int i = 0; i < 5; i++) {
System.out.println(hey[i]);
}
for ( String i: hey) { /*使用for-each迴圈,將each屬於hey陣列的元素*/
System.out.println(i);
}
}
}
/*() round bracket, <> angle角 bracket,[]corner bracket, {}curly bracket捲形
https://en.wikipedia.org/wiki/Bracket
*/
陣列array,方法length,迴圈for-each
教學影片152
重要觀念,期末考
- Java資料型態分成二大類:原型態primitive type與非原型態non-primitive type又稱為參照型態reference type
- 原型態
- 位元數byte
- 短整數short
- 整數int (integer)
- 長整數long:佔8位元組
- 浮點數float:實數
- 倍精數double
- 字元char(character)
- 布林數boolean
- 非原型態
- 類別Class
- 物件Object
- 字串String:是字元characters的串接
- 陣列Array
- 介面Interface
維基教科書,https://zh.wikibooks.org/wiki/Java/
Java的內置類型包括如下幾種:| 類型名稱 | 類型定義 | 類型取值 |
|---|---|---|
| boolean | 布爾值,作二元判斷 | true, false |
| byte | 8位有符號整數 | 最小值-128,最大值127 |
| short | 16位有符號整數 | 最小值-32768,最大值32767 |
| int整數 | 32位有符號整數 | 最小值-2147483648(-231),最大值2147483647(231-1) |
| long | 64位有符號整數 | -263~(263-1) |
| float | 32位浮點數 | 1.4E-45~3.4028235E38 |
| double | 64位浮點數 | 4.9E-324~1.7976931348623157E308 |
| char | 32位Unicode字符(UTF-16) | 不適用(可以與int互相轉換) |
內置類型也稱作基本類型(Primitive Types),是其他類型的基礎。
https://sarahyu-programming.blogspot.com/2022/11/w3school-array-lengthfor-each-11-06-2022.html
回覆刪除https://ericlian-pc.blogspot.com/2022/11/w3schoolarraylengthfor-each.html
回覆刪除https://gracetakming.blogspot.com/2022/11/2022.html
回覆刪除https://www.blogger.com/blog/post/edit/preview/5713569364909360092/3711930764408742385
回覆刪除https://kai1115.blogspot.com/2022/11/w3schoolarraylengthfor-each.html
回覆刪除https://hosidesu.blogspot.com/2022/11/w3schoolsarrayfor-each.html
回覆刪除https://leitrezesig.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://11117102.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://sususu0123.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://sherryd11117110.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://yangkaifen.blogspot.com/2022/11/w3schoolsarraylength.html
回覆刪除https://d10817156.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://gary20010101.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://elainehaung0812.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://jennysuwanting.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://youningningjava.blogspot.com/2022/11/w3schoolarraylengthfor-each.html
回覆刪除https://chen-ping0330.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://hsiehyuche.blogspot.com/2022/11/w3schoolsarrayfor-each.html
回覆刪除https://cathyleerou.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://xiao920727.blogspot.com/2022/11/w3schoolsarrayfor-each.html
回覆刪除https://yang0218.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://java-css-javascript-html.blogspot.com/2022/11/h1background-color-red-color-white.html
回覆刪除https://takmingyiching.blogspot.com/2022/11/w3schoolsarraylengthfor-each.html
回覆刪除https://lilyhuangyuanntakming.blogspot.com/2023/01/w3schoolsarraylengthfor-each.html
回覆刪除