Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java: class , objects

Java: class , objects
1 Inheritance(¼Ì³Ð)µÄ¹Ø¼ü×Öextends
class MountainBike extends Bicycle {
}
µ«ÊDz»ÄܶàÖØ¼Ì³Ð¡£²»¹ý¿ÉÒÔͨ¹ýimplements¶à¸öinterfaceÀ´ÊµÏÖÀàËÆµÄ¶«Î÷
2 interface
interface Bicycle {
       void changeCadence(int newValue);   // wheel revolutions per minute
       void changeGear(int newValue);
       void speedUp(int increment);
       void applyBrakes(int decrement);
}
class ACMEBicycle implements Bicycle {
   // remainder of this class implemented as before
}
¿ÉʵÏÖ(implements)¶à¸öinterface
class MyClass extends MySuperClass implements YourInterface {
    //field, constructor, and method declarations
}
means that MyClass is a subclass of MySuperClass and that it implements the YourInterface interface
3 package
A package is a namespace that organizes a set of related classes and interfaces.
4 Access Modifier
public, private, protected
public class Bicycle {
     private int cadence;
     public int aag;
     public void test();
}
ÿ¸öfield»òmethod¶¼±ØÐëµ¥¶ÀÐÞÊÎ
 
Access Levels
ModifierClassPackageSubclassWorld
public
Y
Y
Y
Y
protected
Y
Y
Y
N
no modifier
Y
Y
N
N
private
Y
N
N
N
Ô¼¶¨£º
class Ãû×ֵĵÚÒ»¸ö×Öĸ´óд; methodµÚÒ»¸öwordÊǶ¯´Ê
5 Constructors
The compiler automatically provides a no-argument, default constructor for any class without constructors.
This default constructor will call the no-argument constructor of the superclass.
6 method & parameter
The Java programming language doesn't let you pass methods into methods. But you can pass an object into a method and then invoke the object's methods.
 can Returning a Class or Interface??
7 this : current object
public class Point {
public int x = 0; //field¿ÉÒÔÕâÑù³õʼ»¯
public int y = 0;


Ïà¹ØÎĵµ£º

javaģʽ֮µ¥Àýģʽ

javaģʽ֮µ¥Àýģʽ£º
          µ¥Àýģʽȷ±£Ò»¸öÀàÖ»ÓÐÒ»¸öʵÀý£¬×ÔÐÐÌṩÕâ¸öʵÀý²¢ÏòÕû¸öϵͳÌṩÕâ¸öʵÀý¡£
 Ìص㣺
       1£¬Ò»¸öÀàÖ»ÄÜÓÐÒ»¸öʵÀý
       2£¬×Ô¼º´´½¨Õâ¸öʵÀý
  & ......

java reflect »úÖÆ

JAVAÓïÑÔÖеķ´Éä»úÖÆ£º
    ÔÚJava ÔËÐÐʱ »·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿
    ¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËûµÄ·½·¨£¿ÕâЩ´ð°¸Êǿ϶¨µÄ£¬ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢£¬ÒÔ¼°¶¯Ì¬µ÷ÓÃÀàµÄ·½·¨µÄ¹¦ÄÜÀ´Ô´ÓÚJAVAµÄ·´Éä¡£´Ó¶øÊ¹java¾ßÓж¯Ì¬ÓïÑÔµÄÌØÐÔ¡£
  JA ......

JAVAÁ¬½ÓÊý¾Ý¿â´óÈ«

 oracle
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String user="scott";
String password="tiger";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_S ......

£¨×ª£©¹ØÓÚjava¿ªÔ´

http://blog.ixpub.net/html/36/16577236-371599.html
06Äê11Ô£¬Sun¹«Ë¾¸ß²ã¹ÙÔ±Ðû²¼£º±à³ÌÓïÑÔJava¿ª·ÅÔ´Â룬²¢ÇÒ×ñÊØGPL¹æÔò£¬²©µÃһƬºÃÆÀ¡£¾­¹ý°ëÄêµÄ²»Ð¸Å¬Á¦£¬SunÖÕÓڰѾßÓÐ 600¶àÍòÐеÄJavaÔ´´úÂ루ָJDKÈí¼þ°ü£©ÕûÀí£¨ÇåÀí£©Íê±Ï£¬¼ÓÒÔ¹«²¼£¬Ê¹Java±äΪÍêÈ«¿ÉÓã¨fully buildable£©µÄ¿ªÔ´±à³ÌÓïÑÔ¡£07Äê5ÔÂ8È ......

java ClassLoader

 µ±JVM£¨JavaÐéÄâ»ú£©Æô¶¯Ê±£¬»áÐγÉÓÉÈý¸öÀà¼ÓÔØÆ÷×é³ÉµÄ³õʼÀà¼ÓÔØÆ÷²ã´Î½á¹¹£º
       bootstrap classloader
                |
       extension classloader
           &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ