随笔分类 -  JavaSE

摘要:冒泡排序 public class ArrayDemo15 { public static void main(String[] args) { int[] a = {5,1,6,8,9,10,345,245,-6}; int[] sort = bubbleSort(a); System.out.p 阅读全文
posted @ 2021-06-27 17:59 多瑞C 阅读(56) 评论(0) 推荐(0)
摘要:Arrays类 打印数组元素 Arrays.toString public class ArrayDemo10 { public static void main(String[] args) { int[] a = {25,12,36,10,28,456,100}; //打印数组元素 Arrays 阅读全文
posted @ 2021-06-27 17:58 多瑞C 阅读(56) 评论(0) 推荐(0)
摘要:多维数组 public class ArrayDemo08 { public static void main(String[] args) { //[4][2] /* 1,2 array[0] 3,4 array[1] 5,6 array[2] 7,8 array[3] */ int[][] ar 阅读全文
posted @ 2021-06-27 17:57 多瑞C 阅读(58) 评论(0) 推荐(0)
摘要:数组使用 1、For-Each 循环 public class ArrayDemo05 { public static void main(String[] args) { int[] arrays = {1,2,3,4,5}; //JDK1.5 没有下标 for ( int array : arr 阅读全文
posted @ 2021-06-27 17:55 多瑞C 阅读(57) 评论(0) 推荐(0)
摘要:内存分析 三种初始化 **int类型没有赋值默认为 0 ** public class ArrayDemo03 { public static void main(String[] args) { //静态初始化:创建 + 赋值 int[] a = {1,2,3,4,5,6,7,8}; System 阅读全文
posted @ 2021-06-27 17:53 多瑞C 阅读(36) 评论(0) 推荐(0)
摘要:数组 1、定义 2、声明创建 public class ArrayDemo01 { public static void main(String[] args) { //变量的类型 变量的名字 = 变量的值; //第一种创建方式 //int[] nums; //1.声明一个数组 //nums = n 阅读全文
posted @ 2021-06-27 17:50 多瑞C 阅读(169) 评论(0) 推荐(0)
摘要:案例 public class MethodDemo11 { public static void main(String[] args) { judge(); } //加法 public static double add(double x,double y) { return x + y; } 阅读全文
posted @ 2021-06-26 17:24 多瑞C 阅读(45) 评论(0) 推荐(0)
摘要:递归 public class MethodDemo09 { //2! 2*1 //3! 3*2*1 //5! 5*4*3*2*1 public static void main(String[] args) { MethodDemo09 demo09 = new MethodDemo09(); i 阅读全文
posted @ 2021-06-26 17:22 多瑞C 阅读(51) 评论(0) 推荐(0)
摘要:可变参数 实际上参数是数组 public class MethodDemo07 { public static void main(String[] args) { MethodDemo07 demo07 = new MethodDemo07(); demo07.test(1,2,3,4,5,6,7 阅读全文
posted @ 2021-06-26 17:19 多瑞C 阅读(51) 评论(0) 推荐(0)
摘要:方法的重载 public class MethodDemo05 { public static void main(String[] args) { int add1 = add(1, 2); System.out.println(add1); System.out.println(" "); in 阅读全文
posted @ 2021-06-26 17:16 多瑞C 阅读(42) 评论(0) 推荐(0)
摘要:方法的定义 形式参数:用来定义作用的 实际参数:实际调用传递给它的参数 方法调用 public class MethodDemo02 { public static void main(String[] args) { int max = max(1, 1); System.out.println( 阅读全文
posted @ 2021-06-26 17:08 多瑞C 阅读(76) 评论(0) 推荐(0)
摘要:何谓方法 public class MethodDemo01 { //main方法 public static void main(String[] args) { int sum = add(1, 2); System.out.println(sum); } //加法 public static 阅读全文
posted @ 2021-06-26 17:05 多瑞C 阅读(82) 评论(0) 推荐(0)
摘要:循环结构 1、while循环 public class WhileDemo01 { public static void main(String[] args) { //输出1~100 int i = 0; while ( i < 100 ) { i++; System.out.println(i) 阅读全文
posted @ 2021-06-26 17:02 多瑞C 阅读(65) 评论(0) 推荐(0)
摘要:选择结构 1、if单选择结构 public class IfSingle { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入内容:"); if 阅读全文
posted @ 2021-06-26 16:53 多瑞C 阅读(92) 评论(0) 推荐(0)
摘要:顺序结构 public class Order { public static void main(String[] args) { System.out.println("Hello1"); System.out.println("Hello2"); System.out.println("Hel 阅读全文
posted @ 2021-06-26 16:51 多瑞C 阅读(48) 评论(0) 推荐(0)
摘要:Scanner对象 1、使用next方式接收 public class UserInputNext { public static void main(String[] args) { //创建一个扫描器对象,用于接收键盘数据 Scanner sc = new Scanner(System.in); 阅读全文
posted @ 2021-06-26 16:43 多瑞C 阅读(110) 评论(0) 推荐(0)
摘要:JavaDoc 1、命令行生成javadoc文档 package com.cc.base; /** * @author cc * @version 1.0 * @since 1.8 */ public class Doc { String name; /** * * @param name * @r 阅读全文
posted @ 2021-06-25 23:21 多瑞C 阅读(32) 评论(0) 推荐(0)
摘要:包机制 阅读全文
posted @ 2021-06-25 23:20 多瑞C 阅读(18) 评论(0) 推荐(0)
摘要:运算符 1、Java 语言支持如下运算符 2、算术运算符 public class BasicOperators { public static void main(String[] args) { //二元运算符 //ctrl + D:复制当前行到下一行 int a = 10; int b = 2 阅读全文
posted @ 2021-06-25 23:19 多瑞C 阅读(100) 评论(0) 推荐(0)
摘要:变量 1、定义 变量是什么:就是可以变化的量 Java是一种强类型语言,每个变量都必须声明其类型 Java变量是程序中最基本的存储单元,其要素包括变量名,变量类型和作用域 public class Variable { public static void main(String[] args) { 阅读全文
posted @ 2021-06-23 23:15 多瑞C 阅读(95) 评论(0) 推荐(0)