摘要: 使用 StringBuilder public class StringConcatenationWithStringBuilder { public static void main(String[] args) { String str1 = "Hello"; String str2 = " W 阅读全文
posted @ 2025-02-20 20:02 吉尼泰梅 阅读(10) 评论(0) 推荐(0)
摘要: 使用 concat() 方法 public class StringConcatenationWithConcat { public static void main(String[] args) { String str1 = "Hello"; String str2 = " World"; // 阅读全文
posted @ 2025-02-20 20:02 吉尼泰梅 阅读(9) 评论(0) 推荐(0)
摘要: 将一个字符串加在另一个字符串末尾并覆盖 public class StringConcatenationWithPlus { public static void main(String[] args) { String str1 = "Hello"; String str2 = " World"; 阅读全文
posted @ 2025-02-20 20:01 吉尼泰梅 阅读(9) 评论(0) 推荐(0)
摘要: 使用 StringBuilder public class StringConcatenationUsingStringBuilder { public static void main(String[] args) { String str1 = "Hello"; String str2 = " 阅读全文
posted @ 2025-02-20 20:00 吉尼泰梅 阅读(5) 评论(0) 推荐(0)
摘要: 使用 concat() 方法 public class StringConcatenationUsingConcat { public static void main(String[] args) { String str1 = "Hello"; String str2 = " World"; / 阅读全文
posted @ 2025-02-20 20:00 吉尼泰梅 阅读(6) 评论(0) 推荐(0)
摘要: 将一个字符串加在另一个字符串末尾,不覆盖 public class StringConcatenationUsingPlus { public static void main(String[] args) { String str1 = "Hello"; String str2 = " World 阅读全文
posted @ 2025-02-20 20:00 吉尼泰梅 阅读(9) 评论(0) 推荐(0)
摘要: 递归方式 public class MaxInArrayRecursive { public static void main(String[] args) { int[] array = {12, 45, 67, 23, 9, 55}; int max = findMaxRecursive(arr 阅读全文
posted @ 2025-02-20 19:58 吉尼泰梅 阅读(8) 评论(0) 推荐(0)
摘要: Java 8 的 Stream API import java.util.Arrays; public class MaxInArrayWithStream { public static void main(String[] args) { int[] array = {12, 45, 67, 2 阅读全文
posted @ 2025-02-20 19:58 吉尼泰梅 阅读(10) 评论(0) 推荐(0)
摘要: 数组最大值(遍历循环) public class MaxInArray { public static void main(String[] args) { int[] array = {12, 45, 67, 23, 9, 55}; int max = findMax(array); System 阅读全文
posted @ 2025-02-20 19:58 吉尼泰梅 阅读(8) 评论(0) 推荐(0)
摘要: 使用 while 循环 public class SumOfDivisibleByThreeWithWhile { public static void main(String[] args) { int sum = 0; int i = 3; // 当 i 小于等于 100 时执行循环 while 阅读全文
posted @ 2025-02-20 19:41 吉尼泰梅 阅读(8) 评论(0) 推荐(0)