• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Java学痴
博客园    首页    新随笔    联系   管理    订阅  订阅
2021年10月18日
重载方法
摘要: 重载方法 public static void main(String[] args) { //重载方法 double max = max(15, 15); System.out.println(max);}//方法的重载方法名相同传递参数类型不同和返回值不同public static int ma 阅读全文
posted @ 2021-10-18 21:00 Java学痴 阅读(91) 评论(0) 推荐(0)
break和continue用法
摘要: break和continue break break 主要用于for循环和switch语句当中但是程序还会继续走下去(只是强制终止循环)for (int i=0;i<100;i++){ System.out.println(i); if (i==30){ break; }} continue con 阅读全文
posted @ 2021-10-18 19:17 Java学痴 阅读(125) 评论(0) 推荐(0)
For循环
摘要: For循环 练习 1 求100以内的奇数 偶数之和 public static void main(String[] args) { //练习1求100以内的奇数 偶数之和 int oddsum=0;//奇数 int evensum=0;//偶数 for (int i=0 ;i<=100;i++){ 阅读全文
posted @ 2021-10-18 15:56 Java学痴 阅读(69) 评论(0) 推荐(0)
while循环
摘要: while循环 1. public static void main(String[] args) { int num=1; int sum=0; while(num<100){ sum=sum+num; num++; System.out.println(num); } } 2.do while 阅读全文
posted @ 2021-10-18 11:38 Java学痴 阅读(97) 评论(0) 推荐(0)
switch选择结构
摘要: switch选择结构 public static void main(String[] args) { //case具有穿透性 如果不用break结束,它会把下面的语句一起执行了 char grade ='B'; switch (grade){ case 'A': System.out.printl 阅读全文
posted @ 2021-10-18 10:59 Java学痴 阅读(37) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3