摘要: 参考 阅读全文
posted @ 2021-06-07 14:40 Henry` 阅读(102) 评论(0) 推荐(0)
摘要: 1.ip public class TestInetAddress { public static void main(String[] args) { try { //查询本机IP,可以new InetAddress byName = InetAddress.getByName("localhos 阅读全文
posted @ 2021-05-29 11:17 Henry` 阅读(126) 评论(0) 推荐(0)
摘要: supper: 1. super调用父类的构造方法,必须在子类构造方法的第一个 2. super必须只能出现在子类的方法或者子类构造方法中 3. super()和this()不能同时调用构造方法,因为必须要在第一个 vs this: 1. 代表的对象不同 this:本身调用者这个对象 super代表 阅读全文
posted @ 2021-05-27 09:17 Henry` 阅读(55) 评论(0) 推荐(0)
摘要: public class ArrayTest { public static void main(String[] args) { int[][] array1 = new int[11][11]; array1[1][2] = 1; array1[2][3] = 2; array1[4][5] = 阅读全文
posted @ 2021-05-26 20:51 Henry` 阅读(24) 评论(0) 推荐(0)
摘要: public class BubbleSortTest { public static void main(String[] args) { int[] arrays = {1,5,3,4,7,8,6,12}; int[] ints = bubbleSort(arrays); System.out. 阅读全文
posted @ 2021-05-26 19:21 Henry` 阅读(46) 评论(0) 推荐(0)
摘要: 其长度是确定的。数组一旦被创建,它的大小就是不可以改变的。 其元素必须是相同类型,不允许出现混合类型。 数组中的元素可以是任何类型,包括基本类型和引用类型。 数组变量属引用类型,数组也可以看成是对象,数组中的每个元素相当于该对象的成员变量。数组本身就是对象,Java中对象是在堆中的,因此数组无论保存 阅读全文
posted @ 2021-05-25 20:50 Henry` 阅读(165) 评论(0) 推荐(0)
摘要: public class TestDemo { public static void main(String[] args) { //打印正三角形 for (int i = 1; i <= 5; i++) {![](https://img2020.cnblogs.com/blog/2406104/2 阅读全文
posted @ 2021-05-24 23:02 Henry` 阅读(197) 评论(0) 推荐(0)
摘要: public class ForDemo2 { public static void main(String[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= i; j++) { System.out.print(i+ "*" 阅读全文
posted @ 2021-05-24 21:48 Henry` 阅读(43) 评论(0) 推荐(0)
摘要: public class ForDemo1 { public static void main(String[] args) { //用while或for循环输出1-1000之间能被5整除的数,并且每行输出4个 for (int i = 0; i <= 1000; i++) { if (i%5==0 阅读全文
posted @ 2021-05-24 21:19 Henry` 阅读(431) 评论(0) 推荐(0)
摘要: public class ForDemo { public static void main(String[] args) { //计算0-100之间的奇数和偶数的和 int oddSum = 0; int evenSum = 0; for (int i = 0; i < 100; i++) { i 阅读全文
posted @ 2021-05-24 21:03 Henry` 阅读(403) 评论(0) 推荐(0)