摘要: package com.wang.array; import java.util.Arrays; public class Demo07 { public static void main(String[] args) { int[] x = {5,92,65,48,24,22,67,65,84,1 阅读全文
posted @ 2023-02-06 22:02 佩德罗帕斯卡 阅读(21) 评论(0) 推荐(0)
摘要: public class Demo03 { public static void main(String[] args) { int [] arrays = {1,2,3,4,5,99}; //打印全部数组元素 for (int i = 0; i < arrays.length; i++) { Sy 阅读全文
posted @ 2023-02-06 22:01 佩德罗帕斯卡 阅读(19) 评论(0) 推荐(0)
摘要: public class Demo01 { public static void main(String[] args) { int[] a; //声明一个数组,名字a a = new int[10]; //创建一个数组,10个长度 int[] b = new int[10]; //直接创建数组方法 阅读全文
posted @ 2023-02-06 21:58 佩德罗帕斯卡 阅读(40) 评论(0) 推荐(0)
摘要: package com.wang.mothod; import java.util.Scanner; public class Demo01 { public static void main(String[] args) { Scanner scanner = new Scanner(System 阅读全文
posted @ 2023-02-06 13:00 佩德罗帕斯卡 阅读(68) 评论(0) 推荐(0)
摘要: public class Demo06 { public static void main(String[] args) { System.out.println(f(5)); } //定义一个方法 阶乘 public static int f(int n){ if(n==1){ return 1; 阅读全文
posted @ 2023-02-06 12:58 佩德罗帕斯卡 阅读(11) 评论(0) 推荐(0)
摘要: 可变参数 public class Demo04 { public static void main(String[] args) { test(1,2,3,4,5,6); } //方法中包含可变参数 public static void test(int... i){ System.out.pri 阅读全文
posted @ 2023-02-06 12:56 佩德罗帕斯卡 阅读(24) 评论(0) 推荐(0)
摘要: 什么是方法 public class Demo02 { public static void main(String[] args) { int sum = add(20, 60);//调用方法 System.out.println(sum); } //新建个加法方法 public static i 阅读全文
posted @ 2023-02-06 12:55 佩德罗帕斯卡 阅读(19) 评论(0) 推荐(0)