摘要: import java.util.ArrayList; public class Aaa { public static void main(String[] args) { ArrayList a=new ArrayList(); for (int i = 0; i < 100; i++) { a.add(i,i+1); ... 阅读全文
posted @ 2016-05-29 08:37 刘某人丶 阅读(131) 评论(0) 推荐(0) 编辑
摘要: package com.hanqi; import java.util.*; public class yc{ public static void main(String[] args) { // TODO 自动生成的方法存根 Scanner sc=new Scanner(System.in); try { ... 阅读全文
posted @ 2016-05-28 08:57 刘某人丶 阅读(205) 评论(0) 推荐(0) 编辑
摘要: package b; public interface Computer { int computer(int n,int m); } package b; public class Jia implements Computer { @Override public int computer(int n, int m) { int jia; ... 阅读全文
posted @ 2016-05-27 08:47 刘某人丶 阅读(2450) 评论(0) 推荐(0) 编辑
摘要: package b; public interface ZuoBiao { double zuobiao(); } public class Point implements ZuoBiao { double x; double y; double z; public double getX() { return x... 阅读全文
posted @ 2016-05-27 08:44 刘某人丶 阅读(6384) 评论(0) 推荐(0) 编辑
摘要: package lianxi; public class Yuan { public static void main(String[] args) { double r=3.0; double circle=2*r*Math.PI; double area=Math.PI*r*r; System. 阅读全文
posted @ 2016-05-24 14:02 刘某人丶 阅读(1856) 评论(0) 推荐(0) 编辑
摘要: 一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下面这段简短的代码: 定义了一个List类型的集合,先向其中加入了两个字符串类型的值,随后加入一个Integer类型的值。这是完全允许的,因为此时list默认的类型为Object类型。在之后的循环中,由于忘记了之前在list中也加入了Integ 阅读全文
posted @ 2016-05-23 22:56 刘某人丶 阅读(18434) 评论(4) 推荐(2) 编辑
摘要: package com.hanqi; public class Pingguo { private String Zhonglei;// 种类 public String getZhonglei() { return Zhonglei; } private String YanSe;// 颜色 public void setYan... 阅读全文
posted @ 2016-05-19 18:44 刘某人丶 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 要产生随机数,可以使用Java api中java.lang包中的Math类.Math类以静态方法的方式提供常用的数学方法, 其中Math.random()方法是一个可以产生[0.0,1.0]区间内的一个双精度浮点数的方法 如: 产生一个100以内的整数:int x=(int)(Math.random 阅读全文
posted @ 2016-05-11 08:37 刘某人丶 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 要产生随机数,可以使用Java api中java.lang包中的Math类.Math类以静态方法的方式提供常用的数学方法, 其中Math.random()方法是一个可以产生[0.0,1.0]区间内的一个双精度浮点数的方法 如: 产生一个100以内的整数:int x=(int)(Math.random... 阅读全文
posted @ 2015-12-17 08:43 刘某人丶 阅读(227) 评论(0) 推荐(0) 编辑
摘要: package com.hanqi1;import java.util.Random;public class Test { public static void main(String[] args) { String str1 = "字符串常量"; //字符串... 阅读全文
posted @ 2015-12-17 08:36 刘某人丶 阅读(145) 评论(0) 推荐(0) 编辑