
Java章节练习
猛肝自然强
这个作者很懒,什么都没留下…
展开
-
章节练习:Java集合
第1题 随机验证码。 随机生成十组六位字符组成的验证码。 验证码由大小写字母、数字字符组成。 代码实现,效果如图所示: 开发提示: 使用字符数组保存原始字符,利用Random类生成随机索引。 将十组验证码放到集合中 用Iterator迭代器遍历集合 package test01; import java.util.*; /** * @author yhm * @create 2020-07-16 15:17 */ public class Test { public static vo原创 2020-07-16 16:45:59 · 574 阅读 · 0 评论 -
章节练习:枚举类&注解
枚举类 第1题 1、声明颜色枚举类: 7个常量对象:赤、橙、黄、绿、青、蓝、紫。 2、在测试类中,使用枚举类,获取绿色对象,并打印对象。 package test1; /** * @author yhm * @create 2020-07-16 14:03 */ public enum Color { RED,ORANGE,YELLOW,GREEN,CYAN,BLUE,PURPLE } package test1; /** * @author yhm * @create 2020-原创 2020-07-16 15:02:21 · 1053 阅读 · 1 评论 -
章节练习:异常处理
代码阅读题 第1题: /** * @author yhm * @create 2020-07-16 11:09 */ public class Test01 { public static int test(int x,int y){ int result = x; try { if (x < 0 || y < 0){ return 0; } re原创 2020-07-16 13:57:20 · 213 阅读 · 0 评论