当前位置: 首页 > news >正文

寻找郑州网站建设网站搭建服务器需要什么

寻找郑州网站建设,网站搭建服务器需要什么,网站开发如何找甲方,佛山seo写这篇博文#xff0c;我并没有特别大的把握。姑且贴代码做分析。遇到什么知识点分析什么知识点吧。 class PersonT {private T age;public void setAge(T age) {this.age age;}public T getAge() {return this.age;} }public class Generics {public static void ma…写这篇博文我并没有特别大的把握。姑且贴代码做分析。遇到什么知识点分析什么知识点吧。 class PersonT {private T age;public void setAge(T age) {this.age age;}public T getAge() {return this.age;} }public class Generics {public static void main(String args[]) {PersonString p new PersonString();p.setAge(3 years old);System.out.println(p.getAge());PersonInteger p2 new PersonInteger();p2.setAge(3);System.out.println(p2.getAge());} }根据贴的这个代码我知道所谓的泛型就是在定义类的时候先不给他确定类内部的一些类型定义。在具体实现对象的时候再给根据需要给予合适的类型。 PersonString p new PersonString 需要注意一下这个地方实现的写法。嗯这个例程就这么点知识。贴下一个 class PersonT {private T age;public void setAge(T age) {this.age age;}public T getAge() {return this.age;} }public class Generics {public static void main(String args[]) {PersonString p new PersonString();p.setAge(3 years old);//System.out.println(p.getAge());printInfo(p);PersonInteger p2 new PersonInteger();p2.setAge(3);//System.out.println(p2.getAge());printInfo(p2);Person? p3;p3 p;//p3.setAge(4 years);p3.getAge();}public static void printInfo(Person? p) {System.out.println(p.getAge());}} 这个代码跟第一次贴的包含的知识点在于 Person? p3;p3 p;//p3.setAge(4 years);p3.getAge() 我们p赋值给定义的一个用通配符设置的p3后。我们的p3竟然没有了设置age的能力。这个特性听特殊的。 继续贴代码 class PersonT {private T age;public void setAge(T age) {this.age age;}public T getAge() {return this.age;} }public class Generics {public static void main(String args[]) {PersonString p new PersonString();p.setAge(3 years old);//System.out.println(p.getAge());printInfo(p);PersonInteger p2 new PersonInteger();p2.setAge(3);//System.out.println(p2.getAge());printInfo(p2);Person? p3;p3 p;//p3.setAge(4 years);p3.getAge();printInfo2(p);printInfo2(p2);printInfo2(p3);}public static void printInfo(Person? p) {System.out.println(p.getAge());}public static T void printInfo2(PersonT p) {System.out.println(p.getAge());}} 这个代码感觉没什么技术含量不说了继续。 class PersonT {private T age;public void setAge(T age) {this.age age;}public T getAge() {return this.age;} }class StudentT extends PersonT { }class Student2 extends PersonString { }public class Generics {public static void main(String args[]) {PersonString p new PersonString();p.setAge(3 years old);//System.out.println(p.getAge());printInfo(p);PersonInteger p2 new PersonInteger();p2.setAge(3);//System.out.println(p2.getAge());printInfo(p2);Person? p3;p3 p;//p3.setAge(4 years);p3.getAge();printInfo2(p);printInfo2(p2);printInfo2(p3);StudentInteger s new StudentInteger();s.setAge(10);printInfo(s);Student2 s2 new Student2();s2.setAge(11 years);printInfo(s2);}public static void printInfo(Person? p) {System.out.println(p.getAge());}public static T void printInfo2(PersonT p) {System.out.println(p.getAge());}} 这个代码的核心知识点在于泛型类的继承 class StudentT extends PersonT { }class Student2 extends PersonString { } 我们继续铁代码分析 interface PersonT {public void setAge(T age);public T getAge(); }class StudentT implements PersonT {T age;public void setAge(T age){this.age age;}public T getAge() {return this.age;} }class Student2 implements PersonString {String age;public void setAge(String age){this.age age;}public String getAge() {return this.age;} }public class Generics {public static void main(String args[]) {StudentInteger s new StudentInteger();s.setAge(10);printInfo(s);Student2 s2 new Student2();s2.setAge(11 years);printInfo(s2);}public static void printInfo(Person? p) {System.out.println(p.getAge());}public static T void printInfo2(PersonT p) {System.out.println(p.getAge());}} 这个代码的重点在于 public static T void printInfo2(PersonT p) {System.out.println(p.getAge());}想要在方法中使用泛型需要在后面添加。写到这里猛然想到如果把这个去掉会怎样呢肯定不可以。如果去掉那么函数中就不能够直接使用这个函数了必须首先做这个类的实现。然后再去调用函数。 继续贴图 interface PersonT {public void setAge(T age);public T getAge(); }/* Integer, Float */ class StudentT extends Number implements PersonT {T age;public void setAge(T age){this.age age;}public T getAge() {return this.age;} }class Student2 implements PersonString {String age;public void setAge(String age){this.age age;}public String getAge() {return this.age;} }public class Generics {public static void main(String args[]) {StudentInteger s new StudentInteger();s.setAge(10);printInfo(s);Student2 s2 new Student2();s2.setAge(11 years);printInfo(s2);}public static void printInfo(Person? p) {System.out.println(p.getAge());}public static T void printInfo2(PersonT p) {System.out.println(p.getAge());}} 介个么就是弄出来个接口类来风骚一下。接口类中的都是全局变量跟抽象函数。别的没啥了。继续贴图 interface PersonT {public void setAge(T age);public T getAge(); }class StudentT implements PersonT {T age;public void setAge(T age){this.age age;}public T getAge() {return this.age;} }class Student2 implements PersonString {String age;public void setAge(String age){this.age age;}public String getAge() {return this.age;} }public class Generics {public static void main(String args[]) {StudentString s new StudentString();s.setAge(10);printInfo(s);Student2 s2 new Student2();s2.setAge(11 years);printInfo(s2);}public static void printInfo(Person? super String p) {System.out.println(p.getAge());}public static T void printInfo2(PersonT p) {System.out.println(p.getAge());}} 这部分讲解的是一个泛型的上限跟下限。只能跟通配符来使用不能跟着来使用也就是说只能在方法实现的时候用。而且经过编程测试在方法实现中也是不能够跟做搭档的。 我编写代码较少。具体还需要后续继续深化吧。
http://www.zqtcl.cn/news/70359/

相关文章:

  • 地产广告设计网站网站搭建同一页不同按钮不同页面
  • 登录中国沈阳网站平面设计包括哪些内容
  • 企业电子网站的建设案例分析瓯北网站制作系统
  • 网站域名使用费网站正在建设中 手机版
  • 青岛手机网站建设重庆市建设工程信息服务平台
  • 商家网站建设临沂网站公众号建设
  • 平台式网站模板下载网站制作报价是否合法
  • 网站的后台是怎么做的中国营销协会官网
  • 网站建设管理概述合肥网站建设 合肥网络推广
  • 用wordpress仿站建设高校图书馆网站的意义
  • 网站公司成功案例怎么写网站建设 李奥贝纳
  • 宁波网站推广公司报价在哪里建网站免费
  • 教育 高校 网站模板专业做商铺的网站
  • ppt怎么做 pc下载网站wordpress 如何修改
  • 专业的教育行业网站制作推广软件的app
  • 设计的网站都有哪些内容我要下载中国建设网站
  • 集约化网站建设管理山西住房建设厅官方网站
  • 制作网站要多少钱网站建设网站制作提供服务
  • 织梦网站查看原有文章论坛源码哪个好
  • 把excel做数据库分享成网站专业企业网站建设定制
  • 网站后台如何更换在线qq咨询代码惠州抖音seo策划
  • 校园网站做等级保护竞价托管哪家效果好
  • 做网站开源框架wordpress怎么静态
  • 网站推广优化方法伊春网络推广
  • wordpress回收站python制作网页教程
  • 贵州网站推广公司动画做a视频在线观看网站
  • 东莞东城招聘网最新招聘seo优化工作内容做什么
  • 哪里有网站建设中心北京必去的十大景点
  • 网站栏目名跨境电商app
  • 做网站业务员vue网站引导页怎么做