
demo
各种小demo
lemon20120331
这个作者很懒,什么都没留下…
展开
-
九九乘法表
九九乘法表 public class Test01 { public static void main(String[] args) { // 控制外圈循环几轮 for (int i = 1; i < 10; i++) { // 控制内圈循环几轮,循环的上限是i的大小 for (int j = 1; j <= i; j++) { System.out.print(j + "*" + i +原创 2020-06-17 09:25:52 · 152 阅读 · 0 评论 -
根据指定日期算时间
从控制台接收一个“生日日期”,计算并打印他来到世界天数 public class Test01 { public static void main(String[] args) { //获取用户输入的时间,字符串格式 Scanner sc = new Scanner(System.in) ; System.out.println("请您输入您的生日日期(格式:yyyy-MM-dd):"); String s = sc.nextLine();原创 2020-06-17 09:17:38 · 567 阅读 · 0 评论 -
排序
冒泡排序 思路: 假设数组的长度是length 请问该数组一共需要比较几趟,length-1 请问个数组第一趟需要比较几次,length - 1 请问个数组第二趟需要比较几次,length - 1 - 1 请问个数组第三趟需要比较几次,length - 1 - 2 … public class BubbleSortDemo { public static void main(String[] args) { // 假设数组的长度是length // 请问该数组原创 2020-06-16 19:56:38 · 170 阅读 · 0 评论 -
模拟斗地主洗牌发牌
模拟斗地主洗牌发牌 public class DouDiZhuDemo { // 1.准备一个Map(编号和牌面) public static HashMap<Integer,String> map = new HashMap<Integer, String>(); public static void main(String[] args) { // 分析斗地主的实现步骤: //花色 String原创 2020-06-16 19:53:50 · 113 阅读 · 0 评论 -
输入一个字符串中每个字符出现次数
需求: 输入一个字符串中每个字符出现次数。 public class TestMapDemo { public static void main(String[] args) { //思考: // a=3 b=5 c=100 e=3 ... //1.创建一个保存结果Map集合 HashMap<Character,Integer> map = new HashMap<Character, Integer>();原创 2020-06-16 19:42:41 · 323 阅读 · 0 评论