Java???????????????????????Э????
???????????? ???????[ 2015/7/3 11:49:47 ] ??????????????? ???????
????????????????????????????
????class TObject
????{
????privateObject obj;
????publicvoid Set(Object object)
????{
????this.obj= object;
????}
????}
??????????????T???????滻?????????Object????????????T?????
??????3????????й???????????????
????class Manipulator<Textends SuperClass>
????{
????private T obj;
????public Manipulator(T x){
????obj = x;
????}
????public void doSomething(){
????obj.f();
????System.out.println(obj.getClass().getName());
????}
????}
????????????????T?????滻????磬???????????????
????class Manipulator
????{
????private SuperClass obj;
????public Manipulator(SuperClass x){
????obj = x;
????}
????public void doSomething(){
????obj.f();
????System.out.println(obj.getClass().getName());
????}
????}
???????????????
?????????????java?????е????????java?з????????????????Ρ?
????????????????????÷??????????????????
??????1?????????????????д????????????????????????????????????????
??????2?????????????????????????????????????????????????????÷?????????????????
????5????Э??
??????1????????????
???????????Э?????????????Э????
?????????Э?????????????????
?????????Э??(covariant)????????Base????Sub????????Base[]??Sub[]?????
?????????????(invariant)???List<Base>??????List<Sub>??????????????????
??????2?????????????Э??
????????“??????????????饗????????”?????????????Э??
????ArrayList<Object> objList = new ArrayList<Long>();
????//can't compile pass
?????????????
????Object[] objArray = new Long[10];
????//compile OK
???????ArrayList<Long>??????????????ArrayList<Object>????????????Υ??????????????????
????????????????????????????????????????з??÷?Long??????????????????ν?????????????????
????????????????????б???????????????Э???????????????п??????
????List<Type> listt = new ArrayList<SubType>();
????//can't compile pass
????List<? extends Type> listt = new ArrayList<SubType>();
????//OK
?????ο?????????????????????
????????Э????????????????????н????????????????????棬????????????????
????ArrayList<Type> list = new ArrayList<Type>();
????//Type is SuperClass
????list.add(new SubType());
????//SubType is SubClass
????Type[] tt = new Type[3];
????tt[0] = new SubType();
??????3???????Э???????????
?????????Э???????????Щ????????????????
????public static voidmain(String[] args) {
????Object[] array = new String[10];
????array[0] = 10;
????}
?????????????????????????????Э????Object[]??????????????????String[]???????????????е??????????????????
????Exception in thread"main" java.lang.ArrayStoreException: java.lang.Integer
??????????????????????????????
????public static voidmain(String[] args) {
????List< Object> list = newArrayList< String>();
????list.add(10);
????}
??????δ??????????????????
????6.??????
?????????????????е????ò?????????????Э??covariant??????????????????????????????????????Э????????
??????????????????List<?>??List<AnyType>?????List<? extends Type>??List<SubType>?????
// collection1???????κ?????
Collection<?>collection1 = new ArrayList<String>();
collection1 = newArrayList<Integer>();
collection1 = newArrayList<Object>();
//collection3???????????Number??Number??????
Collection<?extends Number> collection3 = null;
collection3 = newArrayList<Number>();
collection3 = newArrayList<Double>();
collection3 = newArrayList<Long>();
//collection4???????????Integer??Integer?????
Collection<? superInteger> collection4 = null;
collection4 = newArrayList<Object>();
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????