学习

今天要去面试,复习下基础知识:

android
Http联网方式:
1、标准的java接口:urlconnnect httpconnection
2、apatch开源接口:httpClient

Socket联网:
Socket sock = new Socket("127.0.0.1",13267);

j2me:String name = "http://" + IP+ ":" + Port;
     socket = (StreamConnection)Connector.open(name,Connector.READ_WRITE);

java

 

关于多态,内部类:

public class Implementsinterface {
 private int values= 0;

 public Implementsinterface(){
  
 }
 
 public Implementsinterface(person obj){//参数类型直接用接口,即模糊定义
  obj.print();//具体调用哪个子类的print方法,由运行时绑定控制。多态的好处体现在此
  new test().print();//外部类必须通过内部类的实例才能调用其所有属性,方法
 }
 /**
  * @param args
  */
 public static void main(String[] args) {
  father objf = new father();
  mather objm = new mather();
  new Implementsinterface(objf);
  new Implementsinterface(objm);
  
  Implementsinterface implmt = new Implementsinterface();
  Implementsinterface.test Test = implmt.new test();
 }
 
 private class test{
  int values = 1;
  
  private void print(){
   System.out.println("----" + this.getClass().toString() + values);//类属性,直接用。下面是调用外部类属性
   System.out.println("----" + this.getClass().toString() + this.values);//内部类可以访问外部类的所有属性,方法
  }
  
 }

}


interface person{
 void print();
}

class father implements person{
 public int values = 0;
 public void print(){
  int values = 1;//局部变量跟类属性即使同名也不冲突,冲突的情况:if(true){int values = 0; if(true)int values = 1;)
  System.out.println("----father----" + this.getClass().toString() + values);
 }
}

class mather implements person{
 public void print(){
  System.out.println("----mather----" + this.getClass().toString());
 }
}

 

Android的学习:

今天开始正儿八经的研究下SDK下自带的例子,从APIDemo开始,发现有很多很多不知道的API要去熟悉,去试。

你可能感兴趣的:(学习)