随笔分类 -  Android

摘要:public static void main(String[] args) { // TODO Auto-generated method stub Properties properties = new Properties(); String propertiesDir = System.getProperty("user.dir"); ... 阅读全文
posted @ 2020-09-10 13:51 thomas_blog 阅读(154) 评论(0) 推荐(0) 编辑
摘要:import java.util.HashMap;public class Test { public Test() { // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-generated method stu... 阅读全文
posted @ 2020-09-08 16:09 thomas_blog 阅读(173) 评论(0) 推荐(0) 编辑
摘要:package Person;public class Person { String name; int age; public Person() { // TODO Auto-generated constructor stub } public boolean equals(Object obj) { if (this == obj)... 阅读全文
posted @ 2020-09-08 13:10 thomas_blog 阅读(292) 评论(0) 推荐(0) 编辑
摘要:映射中的每一个元素包含一个键对象和一个值对象,键不可以重复,值可以重复import java.util.HashMap;public class Test { public static void main(String[] args) { // TODO Auto-generated method stub HashMap hashMap = new HashM... 阅读全文
posted @ 2020-09-06 23:34 thomas_blog 阅读(120) 评论(0) 推荐(0) 编辑
摘要:集合中的对象不按特定的方式排序,并且没有重复对象import java.util.HashSet;import java.util.Iterator;import java.util.Set;public class Test { public static void main(String[] args) { // TODO Auto-generated method stu... 阅读全文
posted @ 2020-09-06 22:38 thomas_blog 阅读(96) 评论(0) 推荐(0) 编辑
摘要:import java.util.ArrayList;public class Test { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList arrayList = new ArrayList(); arrayList.add(... 阅读全文
posted @ 2020-09-06 22:11 thomas_blog 阅读(120) 评论(0) 推荐(0) 编辑
摘要:public class MyThread implements Runnable { int i = 0; @Override public void run() { while (true) { synchronized (this) { // TODO Auto-generated method stub ... 阅读全文
posted @ 2020-09-06 14:01 thomas_blog 阅读(145) 评论(0) 推荐(0) 编辑
摘要:public class MyThread implements Runnable { @Override public void run() { // TODO Auto-generated method stub for (int i = 0; i < 100; i++) { System.out.println(Thread.cu... 阅读全文
posted @ 2020-09-06 12:46 thomas_blog 阅读(120) 评论(0) 推荐(0) 编辑
摘要:public class MyThread extends Thread { public void run() { for (int i = 0; i < 100; i++) { System.out.println("MyThread " + i); try { Thread.sleep(100); ... 阅读全文
posted @ 2020-09-04 23:27 thomas_blog 阅读(129) 评论(0) 推荐(0) 编辑
摘要:public interface A { public void func();}public class B implements A { public B() { // TODO Auto-generated constructor stub } @Override public void func() { // TODO Auto-g... 阅读全文
posted @ 2020-09-04 18:50 thomas_blog 阅读(99) 评论(0) 推荐(0) 编辑
摘要:public class A { int i; public A() { // TODO Auto-generated constructor stub } class B { int j; int add() { return i + j; } }}public class Test { ... 阅读全文
posted @ 2020-09-04 18:04 thomas_blog 阅读(144) 评论(0) 推荐(0) 编辑
摘要:public interface Person { void introduce();}public class Student implements Person { public Student() { // TODO Auto-generated constructor stub } public void introduce() { Sy... 阅读全文
posted @ 2020-09-04 16:16 thomas_blog 阅读(148) 评论(0) 推荐(0) 编辑
摘要:使用try…catchpublic class Test { public Test() { // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-generated method stub try {... 阅读全文
posted @ 2020-09-02 16:56 thomas_blog 阅读(167) 评论(0) 推荐(0) 编辑
摘要:定义使用interface定义接口当中的方法都是抽象方法接口当中的方法都是public权限实现实现接口使用implements关键字一个类可以实现多个接口一个接口可以继承多个接口一个类可以实现多个接口public interface USB { void read(); void write();}public interface WiFi { void open(); v... 阅读全文
posted @ 2020-09-02 15:37 thomas_blog 阅读(821) 评论(0) 推荐(0) 编辑
摘要:public同一个包当中,或者不同包当中的类都可以自由访问private只能在本类中使用default(不写权限修饰符,就是default权限)在同一个包当中可以自由访问包导入import使用其他包中的类的时候,不用再使用全名导入单个类import top.zxc.Test导入整个包中所有类import top.zxc.* 阅读全文
posted @ 2020-09-02 14:21 thomas_blog 阅读(130) 评论(0) 推荐(0) 编辑
摘要:防止类重名包名命名规则所有字母小写域名倒过来写一个类的全名“包名”+”.”+”类名”public class Test { public Test() { // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-gen... 阅读全文
posted @ 2020-09-02 13:11 thomas_blog 阅读(150) 评论(0) 推荐(0) 编辑
摘要:使用abstract定义的类抽象类不能够生成对象如果一个类中包含抽象函数,那么这个类必须被声明为抽象类如果一个类中没有抽象函数,那么这个类也可以被声明为抽象类抽象类天生就是爹抽象函数必须在子类中复写abstract public class Person { String name; int age; Person() { System.out.println("P... 阅读全文
posted @ 2020-09-01 23:49 thomas_blog 阅读(182) 评论(0) 推荐(0) 编辑
摘要:包括向上转型和向下转型向上转型将子类的对象赋值给父类的引用一个引用能够调用哪些成员(变量和函数),取决于这个引用的类型一个引用调用的是哪个方法,取决于这个引用所指向的对象public class Person { String name; int age; Person(String name, int age) { this.name = name; ... 阅读全文
posted @ 2020-09-01 19:04 thomas_blog 阅读(236) 评论(0) 推荐(0) 编辑
摘要:子类对introduce进行复写public class Person { String name; int age; Person(String name, int age) { this.name = name; this.age = age; System.out.println("Person 二参构造"); } vo... 阅读全文
posted @ 2020-09-01 13:08 thomas_blog 阅读(342) 评论(0) 推荐(0) 编辑
摘要:使用this调用成员变量和构造函数public class Person { String name; int age; String address; Person() { System.out.println("Person 无参构造"); } Person(String name, int age) { this.name = ... 阅读全文
posted @ 2020-08-31 23:07 thomas_blog 阅读(79) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示