computer 版 (精华区)

发信人: arbo (arbo), 信区: program
标  题: java 上课笔记2
发信站: 听涛站 (2001年09月17日10:41:40 星期一), 站内信件

发信人: airforce1 (五湖废人), 信区: Java
标  题: java 上课笔记2
发信站: BBS 水木清华站 (Sat Apr  1 13:39:11 2000)

下午了。
讲到了interface

interface is a varation on the idea of an abstract class
in a interface, all the methods are abstract
Multiple inheritance can be achieved by implementing such interfaces
syntax
  public interface test{
  public static final int i=1
  public int getI();
}

class test1 implements sayhello{
  void aa(){}
}

about string,
String s="abc"
1 s=="abc" and
2 s.equals("abc") is diffrent.
use no.2, if want to compare two string.

Some Wrapper classes
boolean Boolean
int Int
...
use class to provide support simple data type.
just read some doc about it. it is more powerful than simple data type.

Collection API
Vector, Bits, Stack, Hashtable, LinkedList
Vector class provides methods for working with dynamic arrays of
varied element types
example:
new Vector(10,3) ,
can store 10 element, if more than 10, will add 3 elemnt space every time.
Vector.size() get the number of element
Vector.contains(Object elem), see if the elem is in the Vector.
Vector.setElementAt(Object obj, int index), chance value of indexed element



Reflection API
Constuct new class instances and new arrays
Access and modify fields of objects and classes
Invoke methods on objects and classes
Access and modify elements of arrays
The reflection API is useful in situations where you need to retrieve
and manipulate information at runtime.
for example, it can be used if you are writeing a java sofware interpreter or
debugger.

Reflection API Features
Java.land.class
java.lang.reflect.field
java.lang.reflect.array
java.lang.reflect.constructor




--
--
※ 来源:·听涛站 tingtao.dhs.org·[FROM: 匿名天使的家] 
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:0.882毫秒