廖思涵財金程式設計186_Java預設方法length()與charAt()

w3schools

public class Main { /*廖思涵2022.12.22上午w3school學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); } }

Visual Studio Code

劉任昌財金程式設計186

https://youtube.com/watch?v=9azzDO_INQk&feature=shares

留言

  1. https://yaun3415.blogspot.com/2023/01/javajavascriptinputtextbuttongetvalueby.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

廖思涵Python字典Dictionaries

廖思涵python輸入import數學math函式庫define定義function函數