• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

HSpringX

大学生入门笔记
  • 博客园
  • 联系
  • 订阅
  • 管理

公告

2022年1月11日

Scanner输入时next()和nextLine()可能会发生的错误

摘要: 当 scanner 的 nextXXX() 方法触发了 InputMismatchException 异常,输入的值会保留,直到你调用了 scanner 的 nextXXX() 或next()方法 public class Test1 { public static void main(String 阅读全文

posted @ 2022-01-11 11:48 HSpringX 阅读(218) 评论(0) 推荐(0)

2022年1月8日

万年历

摘要: public class PerpetualCalendar { public static void main(String[] args) { System.out.println("******************欢迎使用万年历*****************"); Scanner sc 阅读全文

posted @ 2022-01-08 16:20 HSpringX 阅读(45) 评论(0) 推荐(0)

日期类Date

摘要: public class DateDemo1 { /* * public Date():分配一个Date对象,并初始化,以便它代表它分配的时间,精确到毫秒 * public Date(long date):分配一个Date对象,并将其初始化为表示从标准基准时间起指定的毫秒数 * public lon 阅读全文

posted @ 2022-01-08 16:19 HSpringX 阅读(43) 评论(0) 推荐(0)

2022年1月5日

泛型的使用

摘要: public class Test1 { public static void main(String[] args) { Test2<String> test2 = new Test2<String>(); Test2<Integer> test21 = new Test2<Integer>("n 阅读全文

posted @ 2022-01-05 16:55 HSpringX 阅读(47) 评论(0) 推荐(0)

2021年12月31日

稀疏数组

摘要: public class sparseArray { public static void main(String[] args) { int[][] array = new int[11][11]; array[1][3] = 1; array[2][4] = 2; for (int[] i:ar 阅读全文

posted @ 2021-12-31 21:45 HSpringX 阅读(25) 评论(0) 推荐(0)

2021年12月26日

Collection接口的常用方法

摘要: 1、add方法:添加 public class CollectionTest { public static void main(String[] args) { Collection<Object> obj = new ArrayList<>(); obj.add(123); obj.add("h 阅读全文

posted @ 2021-12-26 17:45 HSpringX 阅读(88) 评论(0) 推荐(0)

2021年12月25日

方法的调用(类方法和成员方法)

摘要: public class Test1 { public static void main(String[] args) { int show = show();//直接调用 System.out.println("类方法:"+show); int add = Student.add(11, 12); 阅读全文

posted @ 2021-12-25 15:03 HSpringX 阅读(129) 评论(0) 推荐(0)

for循环(打印九九乘法表+增强for循环遍历数组)

摘要: public class Test7 { public static void main(String[] args) { //打印九九乘法表 int s = 0; for (int i=1;i<10;i++){ for (int u=1;u<=i;u++){ s = i*u; System.out 阅读全文

posted @ 2021-12-25 10:38 HSpringX 阅读(51) 评论(0) 推荐(0)

switch结构

摘要: public class Test6 { public static void main(String[] args) { char grade = 'C'; switch (grade) { case 'A': System.out.println("优秀"); break; case 'B': 阅读全文

posted @ 2021-12-25 09:48 HSpringX 阅读(39) 评论(0) 推荐(0)

Scanner的使用(数值相加)

摘要: public class Test5 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("请输入需要相加的数(输入x结束):"); int s 阅读全文

posted @ 2021-12-25 09:25 HSpringX 阅读(73) 评论(0) 推荐(0)

下一页
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3