javaʵÏÖ×ÊÔ´ÏÂÔØ
/Download by HTTP
//For other protocol, do it yourself
import java.net.*;
import java.io.*;
public class DonwLoad
{
public static void main(String args[])
{
DonwLoad dl =new DonwLoad();
String downfile ="http://www.google.cn/music/top100/url?q=http%3A%2F%2Ffile15.top100.cn%2F201003041353%2FF587B34724657ABBF8CBA990E1C82837%2FSpecial_309548%2F%25E5%258B%2587%25E6%2595%25A2%25E7%2588%25B1.mp3&ct=rdl&cad=dl&ei=2EqPS5jgB4easQLM3920Ag&sig=C56A17F31A0C9FA8BBF93E7ED1AFA8C2"; // can be any file type! Not only htm files can be downloaded.
String saveplace ="c:\\test111.mp3"; //´æ´¢Â·¾¶
if(dl.downLoadFile(downfile,saveplace))
System.out.println("Download ok");
}
public boolean downLoadFile(String fileurl, String savepath)
{
try
{
URL url =new URL(fileurl); //
Ïà¹ØÎĵµ£º
°æÈ¨ÉùÃ÷£º×ªÔØÊ±ÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://as112255.blogbus.com/logs/38662785.html
package com.softeem.jbs.lesson4;
import java.util.Random;
/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
* 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐ ......
JavaỊ̈߳º²¢·¢Ð×÷-Éú²úÕßÏû·ÑÕßÄ£ÐÍ
¶ÔÓÚ¶àÏ̳߳ÌÐòÀ´Ëµ£¬²»¹ÜÈκαà³ÌÓïÑÔ£¬Éú²úÕߺÍÏû·ÑÕßÄ£ÐͶ¼ÊÇ×î¾µäµÄ¡£¾ÍÏñѧϰÿһÃűà³ÌÓïÑÔÒ»Ñù£¬Hello World£¡¶¼ÊÇ×î¾µäµÄÀý×Ó¡£
ʵ¼ÊÉÏ£¬×¼È·ËµÓ¦¸ÃÊÇ¡°Éú²úÕß-Ïû·ÑÕß-²Ö´¢¡±Ä£ÐÍ£¬À뿪Á˲ִ¢£¬Éú²úÕßÏû·ÑÕßÄ£Ð;ÍÏÔµÃûÓÐ˵·þÁ¦ÁË¡£
¶ÔÓÚ´ËÄ£ÐÍ£¬Ó¦¸ÃÃ÷ȷһϼ¸µã£º ......
Compositeģʽ(×éºÏ)
JavaÉîÈëµ½Ò»¶¨³Ì¶È,¾Í²»¿É±ÜÃâµÄÅöµ½Éè¼ÆÄ£Ê½ÕâÒ»¸ÅÄî,Á˽âÉè¼ÆÄ£Ê½,½«Ê¹×Ô¼º¶ÔjavaÖеĽӿڻò³éÏóÀàÓ¦ÓÃÓиüÉîµÄÀí½â.Éè¼ÆÄ£Ê½ÔÚjavaµÄÖÐÐÍϵͳÖÐÓ¦Óù㷺,×ñÑÒ»¶¨µÄ±à³Ìģʽ,²ÅÄÜʹ×Ô¼ºµÄ´úÂë±ãÓÚÀí½â,Ò×ÓÚ½»Á÷,Composite(×éºÏģʽ)ģʽÊDZȽϳ£ÓõÄÒ»¸öģʽ.
Composi ......
1, ΪʲôwaitÓënotify֮ǰ±ØÐëÒª¼Ósynchronized?
´ð°¸ÆäʵºÜ¼òµ¥£¬Ò²ÊÇΪÁË·ÀÖ¹µÈ´ý-֪ͨ»úÖÆ³öÏÖrace condition
Ϊʲô»á³öÏÖrace condition ?
´ð£º ¶ÔÏóÔÚ±»wait֮ǰÒѾ±»ÁíÒ»Ïß³Ìnotify , Ö®ºóµÄwait »áÓÀ¾ÃÍ£Ö¹,²¢µ¼ÖÂdeadlock(ËÀËø)
ÀíÏëÇé¿ö£º
1, µÚÒ»¸öÏß³ÌÅжϸöÔÏóÊÇ·ñÒªwait
2, µÚÒ»¸öÏ߳̽«¶ÔÏówait
3 ......
abstract classºÍinterfaceÊÇJavaÓïÑÔÖжÔÓÚ³éÏóÀඨÒå½øÐÐÖ§³ÖµÄÁ½ÖÖ»úÖÆ£¬ÕýÊÇÓÉÓÚÕâÁ½ÖÖ»úÖÆµÄ´æÔÚ£¬²Å¸³ÓèÁËJavaÇ¿´ó
µÄÃæÏò¶ÔÏóÄÜÁ¦¡£abstract classºÍinterfaceÖ®¼äÔÚ¶ÔÓÚ³éÏóÀඨÒåµÄÖ§³Ö·½Ãæ¾ßÓкܴóµÄÏàËÆÐÔ£¬ÉõÖÁ¿ÉÒÔÏà»¥Ìæ»»£¬Òò´ËºÜ¶à¿ª·¢Õß
ÔÚ½øÐгéÏóÀඨÒåʱ¶ÔÓÚabstract classºÍinterface ......