摘要: 非递归: package com.zth; /** * 打印杨辉三角 * @author 时光·漫步 * */ public class SanJiao { public static void main(String[] args) { // 定义数组的长度 int length = 10; in 阅读全文
posted @ 2020-04-18 16:34 Poker1996 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 1.for循环的执行顺序 for(exp1; exp2; exp3) { exp4; } 执行顺序是 1243 243 2.for循环中 exp1;exp2; exp3没有会怎么样 exp1必须要定义,否则编译失败 exp2可以不写,因为没用终止条件所以无限循环下去 exp3也可以不写,也是无限循环 阅读全文
posted @ 2020-04-16 21:38 Poker1996 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。程序分析:利用while语句,条件为输入的字符不为'\n'. 1 Scanner in = new Scanner(System.in); 2 String s = in.nextLine(); 3 int index = 0; 阅读全文
posted @ 2020-04-01 10:35 Poker1996 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1 Scanner in = new Scanner(System.in) 2 String s = in.next();//输入一个字符串内 3 char c = s.charAt(0);//读取字符串s的第1个字符 阅读全文
posted @ 2020-03-22 21:10 Poker1996 阅读(1549) 评论(0) 推荐(0) 编辑