發表文章

李建東W3school補考Java

圖片
w3schools Java Java程式碼 public class Main { /*22023.1.12, w3schooljava*/ public static void main(String[] args) { String a = "狗吃屎,貓抓鼠"; /*宣告字串型態a預設"自己打"*/ String b = ""; /*78""*/ System.out.println(": " + a); for (int i = 0; i

李建東JAVA預設方法length()與charAt()

圖片
public class Main { /*劉任昌2022.12.22上午w3schools學Java字串處理*/ public static void main(String[] args) { String a = "昨夜西風凋碧樹,獨上西樓望盡天涯路"; /*宣告字串型態a預設"自己打"*/ String b = ""; /*宣告字串型態b預設""*/ System.out.println(" 原來的字串: " + a); for (int i = 0; i 小於 a.length(); i++) { b = a.charAt(i) + b; /*Java預設的方法length(), charAt()*/ } /*length()得到字串長度的方法,charAt()得到特定位置的字元*/ System.out.println("反過來的字串: "+ b); } }

李建東Java陣列array長度 D11050135

w3schools陣列array宣告:型態[ ]方括號corner brackets //李建東,2022/1/10,學習陣列,方法length public class Main { public static void main(String[] args) { String[] cars = {"富豪","寶馬","福特","馬自達","撈屎來食"}; int j; /* 宣告位元數 j */ j = cars.length; /* 給定 j = 陣列 cars.長度 */ System.out.println("陣列長度:"+ j );/* 方法印出來print */ for (int i = 0; i

W3Schools 李建東 D11050135

//李建東2022.10.27.期中考準備資料型態 public class Main { /*宣告類別class Main存檔名Main.java*/ public static void main(String[] args) { String a=" 最小數 ", b=" 最大數 "; /*1位元組=8位元*/ String x1="位元數", x2="短整數", x3="整數", x4="長整數"; System.out.println(x1 + a + Byte.MIN_VALUE); /*位元數*/ System.out.println(x1 + b + Byte.MAX_VALUE); System.out.println(x2 + a + Short.MIN_VALUE); /*短整數*/ System.out.println(x2 + b + Short.MAX_VALUE); System.out.println(x3 + a + Integer.MIN_VALUE);/*整數*/ System.out.println(x3 + b + Integer.MAX_VALUE); System.out.println(x4 + a + Long.MIN_VALUE); /*長整數*/ System.out.println(x4 + b + Long.MAX_VALUE); } } style="background-color: white; clear: both; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;"> 資料型態 長度(位元組) 記憶體 位元數byte 1位元組=8位元 bbbbbbbb 短整數short 2位元組=16位元 bbbbbbbb.bbbbbbbb 整數 4位元組=32位元 bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb 長整數 8位元組=64位元 bbbb...

W3schools學習Java雙迴圈,宣告整數int,字串String D11050135李建東

public class Main { /* 李建東2022/10/13德明C506教室 */ public static void main(String[] args) { int i; j; /* 宣告整數integer i, j */ String a="第", b="列: "; /*宣告字串 a, b且設定值 */ for (int i = 0; i

李建東

圖片