随笔分类 - Java学习笔记
摘要:package com.Leo.array;public class ArrayDemo08 { public static void main(String[] args) { //1.创建一个二维数组 11* 11 0:没有棋子 1:黑棋 2:白棋 int[][] array1 = new in
阅读全文
摘要:package com.Leo.array;import java.util.Arrays;//冒泡排序//1. 比较数组中,两个相邻的元素,如果第一个数比第二个数大,我们就交换他们的位置//2. 每一次比较,都会产生一个最大,或者最小的数子;//3. 下一轮则可以少一次排序!//4. 依次循环,直
阅读全文
摘要:package com.Leo.array;import java.util.Arrays;public class ArrayDemo06 { public static void main(String[] args) { int [] a = {1,2,3,4,9090,31231,543,2
阅读全文
摘要:package com.Leo.array;public class ArrayDemo05 { public static void main(String[] args) { //[4][2] /* 1,2 array[0] 2,3 array[1] 3,4 array[2] 4,5 array
阅读全文
摘要:package com.Leo.array;public class ArrayDemo04 { public static void main(String[] args) { int[] arrays = {1,2,3,4,5};//// //JDK1.5 没有下标// for (int arr
阅读全文
摘要:package com.Leo.array;public class ArrayDemo02 { public static void main(String[] args) { //静态初始化:创建 + 赋值 int[] a = {1,2,3,4,5,6,7,8}; System.out.prin
阅读全文
摘要:package com.Leo.array;public class ArrayDemo01 { //变量的类型 变量的名字 = 变量的值‘ //数组类型 public static void main(String[] args) { int[] nums;//1.声明一个数组 nums = ne
阅读全文
摘要:package com.Leo.method;public class Demo05 { public static void main(String[] args) { Demo05 test = new Demo05(); test.test(); } public void test(){ t
阅读全文
摘要:package com.Leo.method;public class Demo04 { public static void main(String[] args) { //调用可变参数的方法 printMax(34, 3, 3, 2, 56.5); printMax(new double[]{1
阅读全文
摘要:package com.Leo.method;public class Demo03 { public static void main(String[] args) { //args.Length 数组长度 for (int i = 0; i < args.length;i++){ System.
阅读全文
摘要:package com.Leo.method;public class Demo02 { public static void main(String[] args) { int max = max(10, 20); System.out.println(max); } //比大小 public s
阅读全文
摘要:package com.Leo.method;public class Demo01 { //main 方法 public static void main(String[] args) { //int sum = add(1,2); //System.out.println(sum); test(
阅读全文
摘要:package com.Leo.struct;public class TestDemo { public static void main(String[] args) { //打印三角形 5行 for (int i = 1; i <= 5; i++) { for (int j = 5; j >=
阅读全文
摘要:package com.Leo.struct;public class BreakDemo { public static void main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if (i==
阅读全文
摘要:package com.Leo.struct;public class ForDemo05 { public static void main(String[] args) { int[] numbers = {10,20,30,40,50};//定义一个数组 for (int i = 0; i <
阅读全文
摘要:package com.Leo.struct;/*1*1=12*1=2 2*2=43*1=3 3*2=6 3*3=94*1=4 4*2=8 4*3=12 4*4=165*1=5 5*2=10 5*3=15 5*4=20 5*5=256*1=6 6*2=12 6*3=18 6*4=24 6*5=30
阅读全文
摘要:package com.Leo.struct;public class ForDemo01 { public static void main(String[] args) { int a = 1;//初始化条件 while (a<=100){//条件判断 System.out.println(a)
阅读全文

浙公网安备 33010602011771号