总结:从键盘输入一组数,输出其最大值,这段代码是错的,因为每次都错在这里,所以自己还是没有理解~~~~

import java.util.Scanner;
//键盘输入一组数据,并输出最小值
//从键盘输入次数,一次输入数据,多次判断大小
//输入n次,并输出每一次的结果显示 public class NKGFD { public static void main(String[] args) {
Scanner c = new Scanner(System.in);
// System.out.println("请输入数-----");
int a[] = new int[5];
for (int i = 0; i < a.length; i++) {
int max = a[2];
System.out.println("请输入一组数=========");
a[i] = c.nextInt();
if (max < a[2]) {
max = a[2];
System.out.println("min is " + max);
} } } }

  

java的错误代码。。。。的更多相关文章

  1. JAVA一些错误代码

    //算术异常 ArithmeticExecption //空指针异常类 NullPointerException //类型强制转换异常 ClassCastException //数组负下标异常 Neg ...

  2. JAVA中 错误代码是 the public type must be defined in its own file 解决方法 android开发 java编程

    一般是由于定义的JAVA类同文件名不一致: 解决方法: 1.把文件名修改同XYZ一样的名字: 2.把类名修改成同文件名:

  3. org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.hs.model.StudentModel]: No default constructor found; nested exception is java.lang.NoSuchMethodException: c

    root cause org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [c ...

  4. 集合操作出现的ConcurrentModificationException(源码分析)

    摘要: 为了保证线程安全,在迭代器迭代的过程中,线程是不能对集合本身进行操作(修改,删除,增加)的,否则会抛出ConcurrentModificationException的异常. 示例: publi ...

  5. Kafka:ZK+Kafka+Spark Streaming集群环境搭建(二十五)Structured Streaming:同一个topic中包含一组数据的多个部分,按照key它们拼接为一条记录(以及遇到的问题)。

    需求: 目前kafka的topic上有一批数据,这些数据被分配到9个不同的partition中(就是发布时key:{m1,m2,m3,m4...m9},value:{records items}),m ...

  6. tomcat无法正确解析请求参数

    24-Mar-2018 14:11:20.564 INFO [http-nio-8080-exec-3] org.apache.coyote.http11.Http11Processor.servic ...

  7. Hibernate异常:IllegalArgumentException

    异常信息: java.lang.IllegalArgumentException: attempt to create delete event with null entity at org.hib ...

  8. JUC——检视阅读

    JUC--检视阅读 参考资料 JUC知识图参考 JUC框架学习顺序参考 J.U.C学习总结参考,简洁直观 易百并发编程,实践操作1,不推荐阅读,不及格 JUC文章,带例子讲解,可以学习2 Doug L ...

  9. Spark案例分析

    一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...

随机推荐

  1. MySQL for Mac 5.7.x 版本忘记密码修改root密码

    1.安装mysql 2.命名别名: vim ~/.bash_profile alias mysql=/usr/local/mysql/bin/mysql alias mysqladmin=/usr/l ...

  2. yii2:如果获取config/web.php配置的值?

    return [ 'version' => '1.0.1', 'category-map' => [ 1 => '样式1', 2 => '样式2', 3 => '样式3' ...

  3. GO学习笔记:函数传值与传指针

    当我们传一个参数值到被调用函数里面时,实际上是传了这个值的一份copy,当在被调用函数中修改参数值的时候,调用函数中相应实参不会发生任何变化,因为数值变化只作用在copy上. 为了验证我们上面的说法, ...

  4. 【Demo】CSS图像拼合技术

    图像拼合 图像拼合 - 简单实例 <style> img.home { width: 46px; height: 44px; background: url(/images/img_nav ...

  5. 简单的音乐轮播JS

    首先说明一点,此篇文章只是为了回应一些博友的要求,本人并非专业搞js的,所以键盘侠和各路大神如果看到此文还请轻喷或者可以直接关掉页面~ 直接上代码: <div id="myboot&q ...

  6. LeetCode OJ:Product of Array Except Self(除己之外的元素乘积)

    Given an array of n integers where n > 1, nums, return an array output such that output[i] is equ ...

  7. LeetCode OJ:Roman to Integer(转换罗马字符到整数)

    Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...

  8. 【PL/SQL编程】注释说明

    1. 单行注释 由两个连接字符“--”开始,后面紧跟着注释内容. 2. 多行注释 由/*开头, 由*/结尾.

  9. 任务调度 Spring Task 4(一)

    深入浅出spring task定时任务 在工作中有用到spring task作为定时任务的处理,spring通过接口TaskExecutor和TaskScheduler这两个接口的方式为异步定时任务提 ...

  10. css权威指南读书笔记

    今天翻手机,翻到了许久之前看css权威指南时的笔记,遂移到博客中来. 1.属性选择器p.one class名为one的p元素p[class][name] 含有class和name属性的p元素p[cla ...