}
}
this.q=q;
public void run(){ }
while(true){ }
q.get();
class Q{ }
private String name=\; private String sex=\; private Boolean bfull=false;
public synchronized void put(String name,String sex){
if(bfull)
try{wait();}catch(Exception e){}//ÈóöCPU this.name=name; this.sex=sex;
bfull=true;//»º³åÇø±ê¼ÇÂú
//»½ÐÑ˯Ãß½ø³Ì£¬¼´Í¨ÖªÏû·ÑÕß
notify(); }
if(!bfull)
public synchronized void get(){
try{wait();}catch(Exception e){}//ÈóöCPU System.out.print(name); System.out.println(sex); bfull=false;//»º³åÇø±ê¼Ç¿Õ
notify();//֪ͨÉú²úÕß }
9¡¢JAVA API£¨Application Programming Interface£© Windows API¾ÍÊÇWindows²Ù×÷ϵͳÌṩ¸ø¸÷ÖÖº¯Êý JAVA API¾ÍÊÇJDKÖÐÌṩµÄ¸÷ÖÖJAVAÀ࣬ ¾ÍÏñººÓïÒªÕÆÎÕ´óÁ¿µÄ³ÉÓïÒ»Ñù£¬Ñ§Ï°JAVA±à³ÌÓïÑÔ¾ÍÓ¦¸ÃÕÆÎÕ´óÁ¿µÄAPI£¬µ«ÕÆÎÕ³£Óõľ͹»ÁË£¬¶ÔÓÚרÃŵģ¬Õë¶ÔʵÀýÀ´ÔËÐУ¬¾¡Á¿ÏÖѧÏÖÓ㬽èÖú¿ª·¢¹¤¾ßµÄÌáʾ£¬¶à½»Á÷ BORLAND ---JBUILDER IBM---VISUAL AGE
SUN ---SUN ONE STUDIO JCREATOR
ÈüÃÅÌú¿ËµÄVISUAL CAF¨¦
11¡¢StringÀàºÍStringBufferÀࣺ·â×°×Ö·û´®µÄ²Ù×÷
λÓÚjava.langÖУ¬¸Ã°üÖеÄÄÚÈÝ¿ÉÒÔÖ±½ÓʹÓ㬲»Óõ¼Èë StringÀà¶ÔÏóÖеÄÄÚÈÝÒ»µ©±»³õʼ»¯¾Í²»Äܸü¸Ä StringBufferÀà¶ÔÏóÖеÄÄÚÈݳõʼ»¯ºó¿ÉÒÔ¸ü¸Ä£¬ ¿ÉÒÔÓÃtoString·½·¨×ª»»³ÉStringÀàÐÍ£¬À´½øÐвÙ×÷ StringÀà¿ÉÒÔÓá°+¡±À´Á¬½Ó×Ö·û´®£¬µÈЧÓënew StringBuffer().apppend(¡°a¡±).append(¡°b¡±).toString ×Ö·û´®³£Á¿Êµ¼ÊÉÏÊÇÒ»ÖÖÌØÊâµÄÄäÃûSTRING£¬Èç¡°HELLO¡± ±à³Ì£ºÖðÐжÁÈë¼üÅÌÊäÈëµÄÄÚÈÝ£¬Ö±µ½ÊäÈëΪBYE
public class String_Exer {
public static void main(String[] args) {
byte[] buf=new byte[1024];//´æ´¢»Ø³µÇ°µÄÄÚÈÝ String strInfo=null;//Êä³öµÄ×Ö·û´®£¬ÒªÏÔʾ³õʼ»¯ int pos=0;//Êý×éÖеÄλÖà int ch=0; while(true){
try{ch=System.in.read();}catch(Exception e){}//´Ó¼üÅ̶Áȡһ¸ö
×Ö½ÚµÄÄÚÈÝ switch(ch){
case '\\r':break;//»Ø³µ£¬²»½øÐд¦Àí
case '\\n':strInfo=new String(buf,0,pos);
if(strInfo.equals(\))//×¢Òâ²»ÒªÓá°==¡±£¬ËüÊDZȽÏ
Á½¸ö¶ÔÏóÊÇ·ñÏ൱£¬ÕâÀïÒª±È½ÏÄÚÈÝ return; }
}
}
}
else {
System.out.println(strInfo); pos=0; break; }
default:buf[pos++]=(byte)ch;
StingÖеij£Ó÷½·¨
¹¹Ôì·½·¨£ºString(byte[] bytes,int offset,int length)
equalsIgnoreCase·½·¨£ºÓëequalsÏàËÆ£¬µ«ºöÂÔ´óСд£¬Èç
if(strInfo.equals(\))//if(strInfo.equalsIgnoreCase(¡°bye¡±);
indexOf(int ch)·½·¨£¬·µ»Ø×Ö·ûÊ×´ÎÔÚ´®ÖеijöÏÖλÖã¬Èç System.out.println(¡°hello world¡±.index(¡®o¡¯);
System.out.println(¡°hello world¡±.index(¡®o¡¯,5);´ÓµÚÎå¸ö¿ªÊ¼ÕÒ
substring(int beginIndex)·½·¨£º·µ»Ø´ÓbeginIndexµ½×Ö·û´®½áβ¼äµÄ×Ö·ûÐγɵÄ×Ö·û´® substring(int beginIndex£¬int endIndex)
System.out.println(¡°hello world¡±.substring(6);
System.out.println(¡°hello world¡±.substring(6,8);
12¡¢»ù±¾Êý¾ÝÀàÐ͵ĶÔÏó°ü×°Àà
JAVA¼ÈÌṩÁ˼òµ¥ÀàÐÍ£¬ÓÖÌṩÁËÏàÓ¦µÄ°ü×°À࣬ʹÓûù±¾ÀàÐ͵ļòµ¥ÀàÐÍ¿ÉÒÔ¸ÄÉÆÏµÍ³ÐÔÄܺÍÂú×ã»ù±¾ÐèÇ󣬵«²»¾ßÓÐÃæÏò¶ÔÏóµÄÌØÐÔ£¬²»¾ßÓÐÄ³Ð©ÌØÊâµÄ¹¦ÄÜ£¬JAVAÖкܶàÀàÒªÇ󴫵ݵÄÊǶÔÏó£¬Òò´Ë£¬ÓбØÒªÒýÈë°ü×°À࣬´ËÍâ°ü×°Àà½øÐÐÊý¾ÝÀàÐ͵Äת»»Ò²ÊÇÌØ±ðÓÐÓõġ£Õâ8Öлù±¾ÀàÐͶ¼ÓÐÆä°ü×°À࣬ÏÂÃæÒÔINTΪÀý »ù±¾Êý¾ÝÀàÐÍ boolean byte char short int long float double °ü×°Àà Boolean Byte Character Short Integer Long Float Double ±à³Ì£º
´òÓ¡Ò»¸ö¡±*¡±¾ØÕ󣬳¤¿íÓÉÔËÐеÄmain´«Èë public class TestInteger { public static void main(String[] args) { // TODO Auto-generated method stub
int kuan=new Integer(args[0]).intValue();//ÈýÖÖ×Ö·û´®×ª»»Îªint·½·¨ int gao=Integer.parseInt(args[1]); //int gao=Integer.valueOf(args[1].intValue(); for(int i=0;i ÔÚMYECLIPSEÖÐÔËÐÐʱ´«Èë²ÎÊýµÄÉèÖ÷½·¨£ºÔÚ´úÂëÇø»÷ÓÒ¼ü£¬³öÏÖÏÂÃæµÄ»Ã棬ѡÔñrun asºóÃæµÄopen run dialog È»ºóÑ¡Ôñargments±êÇ©£¬Ö±½ÓÊäÈë²ÎÊý£¬²ÎÊý¼äÓÿոñ£¬ÈçÏÂͼ Ñ¡ÔñÔËÐм´¿É