上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: 正方形: public void print() { for(int i=1;i<=5;i++){ for(int j=1;j<=5;j++){ System.out.print("* "); } System.out.println(); } } 运行结果: * * * * * * * * * * 阅读全文
posted @ 2022-11-21 15:58 Liku007 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 数组在查询和修改文件的时候效率是很快的,但是新增和删除效率不高,因为他们都是根据索引查值,这里我们用集合来替换数组 集合 理论上存储不同类型的不定量的元素数据。但是实际开发中还是存储相同类型的数据。且集合只能存储引用类型的数据 :泛型的标志 类型的自动转换 默认object,T就类似形式参数一样,是 阅读全文
posted @ 2022-11-18 22:26 Liku007 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 字符串转日期 Date/Calendar类 date类 现阶段讲的date是位于util包下的一个类,他拥有的方法有(其他方法都弃用了): //常用构造: Date(); Date(long date); //常用方法: long getTime(); private static void dem 阅读全文
posted @ 2022-11-16 19:20 Liku007 阅读(39) 评论(0) 推荐(0) 编辑
摘要: private static void libraryDemo() { String[] bookNames = {"《西游记》", "《红楼梦》", "《水浒传》", "《三国演义》"}; String[] bookAuthor = {"吴承恩", "曹雪芹", "施耐庵", "罗贯中"}; do 阅读全文
posted @ 2022-11-15 17:53 Liku007 阅读(31) 评论(0) 推荐(0) 编辑
摘要: private static void demo4() { String[][] menu = { {"糖醋带鱼", "12", "加辣", "加葱"}, {"麻婆豆腐", "15", "加辣"}, {"南昌拌粉", "13", "加葱"}, {"农家小炒肉", "17"}, {"梅菜扣肉", "2 阅读全文
posted @ 2022-11-15 17:50 Liku007 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 判断邮箱输入是否合法,并且判断输入的邮箱是否是新浪邮箱 private static void demo1() { System.out.println("请输入您的邮箱"); String email = input.next(); String emailRegex = "^([a-zA-Z0- 阅读全文
posted @ 2022-11-11 14:18 Liku007 阅读(40) 评论(0) 推荐(0) 编辑
摘要: string的值是不可变的,因为底层用的是final修饰的一个char数组 字符串的定义 String str1="hello"; String str2=new String("hello"); string容易出现的问题: private static void demo1() { String 阅读全文
posted @ 2022-11-11 09:28 Liku007 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序 对于数组个数比较少的,我们可以采用冒泡排序的方法来进行排序,他的原理其实是利用两层循环来进行比较,如果n个数要进行排序,那至少要进行n-1次的回合,而且每次需要排n-i次,就像吐泡泡一样,因此可以进行以下代码的编写 1 public static void main(String[] ar 阅读全文
posted @ 2022-11-10 09:09 Liku007 阅读(37) 评论(0) 推荐(0) 编辑
摘要: String str = "huechsghkshhj"; int len = str.length(); char[] c = new char[len]; int i = 0; for (int index = 0; index < len; index++) { boolean flag = 阅读全文
posted @ 2022-11-09 21:58 Liku007 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Date时间类: Date date=new Date();//获得当前系统的日期和时间 System.out.println(date); long time=date.getTime();//获得毫秒数 System.out.println(time);//自1970年1月1日起以毫秒为单位的时 阅读全文
posted @ 2022-11-09 09:06 Liku007 阅读(12) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页