- 博客(12)
- 收藏
- 关注
原创 HashMap学习
import java.util.Collection;import java.util.HashMap;import java.util.Map;import java.util.Set;public class HashMapDemo {public static void main(String[] args) {// TODO Auto-genera
2016-03-29 17:23:47 94
原创 final static区别示例
public class finalStaticDemo {public static void main(String[] args) {// TODO Auto-generated method stubString a = "hello2"; String aa="hellohello"; final String b = "hello";
2016-03-29 15:10:54 465
原创 Arraylist查看源代码
import java.util.ArrayList;import java.util.Iterator;class ArrayListDemo {public static void main(String[] args) {ArrayList al=new ArrayList();Student stu1=new Student("xiaoyi",20);
2016-03-17 17:18:17 892
原创 泛型数据容器Demo
import java.util.Arrays;import java.util.Scanner;class GenContainerDemo {public static void main(String[] args) {//GenContainer gc=new GenContainer();IContainer ic=new GenContainer();D
2016-03-15 16:46:30 253
原创 泛型方法Demo
class GenClassDemo5 {public static void main(String[] args) {Animal a=Animal.NewInstance();//静态成员子类,被用来了单例抽象类。a.tell("da");a.show(2.11);Animal.SubDemo as=a.new SubDemo();//成员内部类,调用方法
2016-03-13 11:55:25 425
原创 Java泛型通配符super使用Demo
class GenClassDemo4 {public static void main(String[] args) {SupGen sg=new SupGen();sg.setVar1(new Dog());sg.getVar1().tell();//SupGen sg=new SupGen(); /*GenClassDemo4.java:5: 错误:
2016-03-12 22:18:27 495
原创 Java泛型限制Demo3
class GenClassDemo3 {public static String str;public static Integer i;public static void main(String[] args) {//(Object)str="hello"; //:7: 错误: 意外的类型//(Object)i=10; //:7: 错误: 意外的类型//
2016-03-12 21:07:31 461
原创 泛型继承接口Demo
class GenClassDemo2 {public static void main(String[] args) {//System.out.println("Hello World!");SubGen sg=new SubGen("李四",30);System.out.println(sg.show()+"--"+sg.show2());sg.show4(35)
2016-03-08 18:40:55 503
原创 Java泛型Demo
class GenClassDemo{public static void main(String[] args) {GenClass gc=new GenClass(20.11);GenClass2 gc2=new GenClass2(30);gc.tell();gc2.tell(); //可以看到如果非泛型的时候:元素或者方法类型可以是基本类型,也可以是基类的包
2016-03-07 18:00:01 420
原创 java 自定义异常Demo
import java.util.Random;class WorkDoctorDemo{public static void main(String[] args) {Worker worker=new Worker();Doctor docter=new Doctor();try{worker.work();}catch (SickExceptio
2016-03-07 00:35:53 491
原创 try catch finally throw throws异常捕获和抛出demo
package com.age.www;import java.util.InputMismatchException;import java.util.Scanner;class TryCatchDemo {public static void main(String[] args) {ThrowDemo td=new ThrowDemo();Syst
2016-03-04 16:13:44 344
原创 java反射copy对象实例
package com.age.www;import java.lang.reflect.Array;import java.lang.reflect.Method;import java.lang.reflect.Field;class ReflectCopyDemo { public static void main(String[] args) throws
2016-03-02 10:18:23 424
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人