2021-11-14_学习《Java核心技术:卷I基础知识》《数据结构与算法分析:Java语言描述》的总结
一、2021-11-14学习《Java核心技术:卷I基础知识》的总结:
1.String API
Spring API 之 int length():
class Welcome { public static void main(String[] args) { String greeting = "Welcome to Core Java!"; System.out.println(greeting); for (int i = 0; i < greeting.length(); i++) { System.out.print("="); } System.out.println(); // 备注:执行效果如下: // "Welcome to Core Java!" // "=====================" } }
String API 之 String substring(int beginIndex, int endIndex)、Char charAt(int index):
class StringDemoP45 { public static void main(String[] args) { String greeting = "Hello"; String s = greeting.substring(0, 3); System.out.println(s); // "Hel" String all = String.join(" / ", "S", "M", "L", "XL"); System.out.println(all); // "S / M / L / XL" char last = greeting.charAt(4); System.out.println(last); // "o" } }
String API(部分,还差好多今天没画,待补充)思维导图:
2.Java基本数据类型思维导图:
3.关键字final部分用法思维导图;
二、2021-11-14学习《数据结构与算法分析:Java语言描述》的总结:
1.递归demo1:
recursive [rɪˈkɜːsɪv] 递归的
class RecursiveP15 { public static void main(String[] args) { System.out.println("fRecursive(4)=" + fRecursive(4)); // 结果为:"fRecursive(4)=58" } public static int fRecursive(int x) { if (x==0) { return 0; } else { return 2 * fRecursive(x - 1) + x * x; } } }
2.递归demo2:
class PrintIntegerP17 { public static void main(String[] args) { printOut(521); // "521" } public static void printOut(int n) { if (n >= 10) { printOut( n / 10 ); } printDigit( n % 10 ); } public static void printDigit(int n) { System.out.print(n); } }