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






许先

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  java基础

1 2 下一页

 
31.向数组中插入一个元素
摘要:import java.util.*; public class Insert { public static void main(String[] args) { int[] list = new int[6]; // 长度为为6的数组 list[0] = 99; list[1] = 85; list[2] = 82;... 阅读全文
posted @ 2016-05-27 22:59 许先 阅读(371) 评论(0) 推荐(0)
30.使用Arrays类的各种方法
摘要:import java.util.Arrays; public class ArraysMethod { public static void main(String[] args) { //equals(array1,array2) 的作用是:比较两个数组是否相等 System.out.println("----equals(array1,array2... 阅读全文
posted @ 2016-05-27 22:58 许先 阅读(320) 评论(0) 推荐(0)
29.求数组最大值
摘要:import java.util.Scanner; public class MaxScore { /** * 求数组最大值 */ public static void main(String[] args) { int[] scores = new int[5]; int max = 0; //记录最大值 ... 阅读全文
posted @ 2016-05-27 22:56 许先 阅读(202) 评论(0) 推荐(0)
28.冒泡排序
摘要:/* * 冒泡排序 * */ public class SortNum { public static void main(String[] args) { int[] scores={16,25,9,90,23}; for (int i = 0; i scores[j + 1]) { ... 阅读全文
posted @ 2016-05-27 22:42 许先 阅读(212) 评论(0) 推荐(0)
26.Arrays排序
摘要:import java.util.Arrays; import java.util.Scanner; /* * Arrays排序5名学员成绩 * */ public class ArraysSortScore { public static void main(String[] args) { int[] scores=new int[5]; Sca... 阅读全文
posted @ 2016-05-27 22:40 许先 阅读(250) 评论(0) 推荐(0)
27.遍历二维数组
摘要:import java.util.Scanner; /** * 有5个班各5名学生某门课程的成绩,计算5个班各自的总成绩 * */ public class FiveTotal { public static void main(String[] args) { Scanner input=new Scanner(System.in); int []... 阅读全文
posted @ 2016-05-27 22:40 许先 阅读(213) 评论(0) 推荐(0)
25.购物金额结算
摘要:import java.util.Scanner; public class ShoppingList { /** * 购物金额结算 */ public static void main(String[] args) { double[] cashes = new double[5]; double sum = 0.0; ... 阅读全文
posted @ 2016-05-27 22:38 许先 阅读(452) 评论(0) 推荐(0)
23.使用数组计算平均分
摘要:import java.util.Scanner; public class ArrayDemo { /** * 使用数组计算平均分 */ public static void main(String[] args) { int[] scores = new int[5]; //成绩数组 int sum = 0; ... 阅读全文
posted @ 2016-05-27 22:37 许先 阅读(970) 评论(0) 推荐(0)
24.打印9*9乘法表
摘要:/* * 打印9*9乘法表 */ public class Multiplication { public static void main(String[] args) { int i, j; // 循环变量 for (i = 1; i <= 9; i++){ // 外层循环控制被乘数 for (j = ... 阅读全文
posted @ 2016-05-27 22:37 许先 阅读(254) 评论(0) 推荐(0)
22.猜数游戏
摘要:import java.util.*; public class GuessData { public static void main(String[] args) { int[] list = new int[] { 8, 4, 2, 1, 23, 344, 12 }; // 创建数组并赋值 int sum=0; ... 阅读全文
posted @ 2016-05-27 22:36 许先 阅读(175) 评论(0) 推荐(0)
21.使用双重循环打印图形
摘要:/* * 打印菱形 * */ public class PrintLX { public static void main(String[] args) { //外层循环,执行五次,每次输出一行* for (int i = 1; i <= 5; i++) { for(int j=1;j<=5-i;j++){ ... 阅读全文
posted @ 2016-05-27 22:35 许先 阅读(2441) 评论(0) 推荐(0)
20.使用continue语句
摘要:import java.util.Scanner; public class ContinueDemo { /** * 统计80分以上学生比例 */ public static void main(String[] args) { int score; // 成绩 int total; // 班级... 阅读全文
posted @ 2016-05-27 22:33 许先 阅读(212) 评论(0) 推荐(0)
19.使用break语句
摘要:import java.util.Scanner; public class BreakDemo { /** * 循环录入学生成绩,输入负数则退出 */ public static void main(String[] args) { int score; //每门课的成绩 ... 阅读全文
posted @ 2016-05-27 22:32 许先 阅读(276) 评论(0) 推荐(0)
18.计算100以内偶数之和
摘要:public class EvenSum { /* * 计算100以内偶数之和 * 思考:还有没有其他方式? */ public static void main(String[] args) { //使用while /*int sum = 0; //当前之和 int num = 2; /... 阅读全文
posted @ 2016-05-27 22:31 许先 阅读(1498) 评论(0) 推荐(0)
16.输出加法表
摘要:package cn.jbit.loops2; import java.util.*; public class SumTable { /** * 输入整数,输出其加法表 */ public static void main(String[] args){ int i, j; Scanner input = new Scann... 阅读全文
posted @ 2016-05-27 22:29 许先 阅读(387) 评论(0) 推荐(0)
17.商品价格查询
摘要:package cn.jbit.loops1; import java.util.Scanner; public class PriceLookup { /* * 商品价格查询 */ public static void main(String[] args) { String name = ""; //商品名称 ... 阅读全文
posted @ 2016-05-27 22:29 许先 阅读(258) 评论(0) 推荐(0)
15.使用while循环
摘要:package cn.jbit.loops1; import java.util.Scanner; public class WhileDemo { /* * 如何使用while循环 */ public static void main(String[] args) { int count = 1; while(c... 阅读全文
posted @ 2016-05-27 22:27 许先 阅读(178) 评论(0) 推荐(0)
14.do-while循环
摘要:package cn.jbit.loops1; import java.util.Scanner; public class DoWhileDemo { /* * 如何使用do-while循环 */ public static void main(String[] args) { Scanner input = new Scanner(S... 阅读全文
posted @ 2016-05-27 22:26 许先 阅读(149) 评论(0) 推荐(0)
13.计算平均分
摘要:package cn.jbit.loops2; import java.util.*; public class AverageScore{ /** * 统计80分以上学生比例 */ public static void main(String[] args){ int score; //每门课的成绩 ... 阅读全文
posted @ 2016-05-27 22:25 许先 阅读(219) 评论(0) 推荐(0)
12.复杂条件下的if
摘要:package com.bdqn; import java.util.Scanner; public class GetPrize2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("输入张浩的Jav... 阅读全文
posted @ 2016-05-27 22:24 许先 阅读(208) 评论(0) 推荐(0)
 

1 2 下一页