摘要: public class Generic1<T> { private T name; public void get(T name){ this.name = name; } public T show(){ return this.name; } } public class get { publ 阅读全文
posted @ 2022-01-18 21:50 iiuu也一样 阅读(31) 评论(0) 推荐(0) 编辑
摘要: public class MethodGeneric1 { public <T> void method(T...args){ for(T t:args){ System.out.println(t); } } } public class Test4 { public static void ma 阅读全文
posted @ 2022-01-18 14:55 iiuu也一样 阅读(26) 评论(0) 推荐(0) 编辑
摘要: //非静态方法使用泛型public class MethodGeneric { public<T> void getName(T name){ System.out.println(name); } public <T> T putName(T name){ return name; } } pub 阅读全文
posted @ 2022-01-18 14:06 iiuu也一样 阅读(72) 评论(0) 推荐(0) 编辑
摘要: //接口 public interface Igeneric<T> { T getName(T name); } //实现接口类 public class IgenericImpl implements Igeneric<String>{ @Override public String getNam 阅读全文
posted @ 2022-01-18 13:43 iiuu也一样 阅读(22) 评论(0) 推荐(0) 编辑
摘要: public class Generic<T> { private T flag; public void setFlag(T flag){ this.flag = flag; } public T getFlag(){ return this.flag; } } public class Test 阅读全文
posted @ 2022-01-18 11:46 iiuu也一样 阅读(25) 评论(0) 推荐(0) 编辑
摘要: public class TestEnum { public static void main(String[ ] args) { // 枚举遍历 for (Week k : Week.values()) {//values获取枚举所有对像 System.out.println(k); } // s 阅读全文
posted @ 2022-01-18 00:01 iiuu也一样 阅读(31) 评论(0) 推荐(0) 编辑
摘要: import java.io.File; public class TestFile2 { public static void main(String[ ] args) { File f = new File("D:\\尚学堂第二阶段代码"); printFile(f, 0); } /** * 打 阅读全文
posted @ 2022-01-17 22:59 iiuu也一样 阅读(38) 评论(0) 推荐(0) 编辑
摘要: import java.io.File; import java.io.IOException; import java.util.Date; public class TestFile { public static void main(String[]args) throws IOExcepti 阅读全文
posted @ 2022-01-17 20:13 iiuu也一样 阅读(25) 评论(0) 推荐(0) 编辑
摘要: import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class TestDateFormat { 阅读全文
posted @ 2022-01-17 18:02 iiuu也一样 阅读(31) 评论(0) 推荐(0) 编辑
摘要: import java.util.Date; //测试时间类 public class TestDate { public static void main(String[]args){ long nowNum = System.currentTimeMillis(); System.out.pri 阅读全文
posted @ 2022-01-17 15:47 iiuu也一样 阅读(17) 评论(0) 推荐(0) 编辑