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

ÂùÁ¦·¨ºÍ·ÖÖη¨ Çó×î½ü¶ÔÎÊÌâ——Java ʵÏÖ

Éèp1=(x1, y1), p2=(x2, y2), …, pn=(xn, yn)ÊÇƽÃæÉÏn¸öµã¹¹³ÉµÄ¼¯ºÏS£¬Éè¼ÆËã·¨ÕÒ³ö¼¯ºÏSÖоàÀë×î½üµÄµã¶Ô¡£
ÂùÁ¦Ëã·¨ÃèÊö£º
int ClosestPoints(int n, int x[ ], int y[ ], int &index1, int &index2)
{
   minDist=+∞;
   for (i=1; i<n; i++)
      for (j=i+1; j<=n; j++)
     {
         d=(x[i]-x[j])* (x[i]-x[j])+(y[i]-y[j])* (y[i]-y[j]); 
         if (d<minDist) {
             minDist=d;
             index1=i;
             index2=j;
        }
      }
     return  minDist;
}
ClosestPair1.java                                         //ÂùÁ¦Ëã·¨
import java.util.*;
public class ClosestPair1
{
 public static void main(String[] args)
 {
  /**
   *ÊäÈëÐèÒª±È½ÏµÄµãµÄ¶ÔÊý´æÔÚ±äÁ¿nÖÐ
   */
  Scanner in=new Scanner(System.in);
  System.out.println("How many pairs of points to compare?(ÓжàÉÙ¶ÔµãÐèÒª±È½Ï?)");
  int n=in.nextInt();
  
  int[] x=new int[n];
  int[] y=new int[n];
  /**
   *ÊäÈëÕâЩµãµÄºá×ø±êºÍ×Ý×ø±ê·Ö±ð´æ´¢ÔÚx[n]ºÍy[n]
   */
  System.out.println("Please enter these points,X-coordinate(ÇëÊäÈëÕâЩµã,ºá×ø±ê):");
  for(int i=0;i<n;i++)
  {
   x[i]=in.nextInt();
  }
  
  System.out.println("Please enter


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

JavaÏß³Ìͬ²½»úÖÆsynchronized¹Ø¼ü×ÖµÄÀí½â

¡¾IT168 ¼¼ÊõÎĵµ¡¿Ïß³Ìͬ²½£º
¡¡¡¡ÓÉÓÚͬһ½ø³ÌµÄ¶à¸öÏ̹߳²ÏíͬһƬ´æ´¢¿Õ¼ä£¬ÔÚ´øÀ´·½±ãµÄͬʱ£¬Ò²´øÀ´ÁË·ÃÎʳåÍ»Õâ¸öÑÏÖصÄÎÊÌâ¡£JavaÓïÑÔÌṩÁËרÃÅ»úÖÆÒÔ½â¾öÕâÖÖ³åÍ»£¬ÓÐЧ±ÜÃâÁËͬһ¸öÊý¾Ý¶ÔÏ󱻶à¸öÏß³Ìͬʱ·ÃÎÊ¡£
¡¡¡¡ÐèÒªÃ÷È·µÄ¼¸¸öÎÊÌ⣺
¡¡¡¡1)synchronized¹Ø¼ü×Ö¿ÉÒÔ×÷Ϊº¯ÊýµÄÐÞÊηû£¬Ò²¿É×÷Ϊº¯ÊýÄÚµÄÓï ......

JAVA½ø½×£ºÒ»¸ö¼òµ¥Thread»º³å³ØµÄʵÏÖ


ÔÚÓ¦ÓÃÖУ¬ÎÒÃdz£³£ÐèÒªThread»º³å³ØÀ´×öһЩÊÂÒÔÌá¸ß³ÌÐòµÄЧÂʺͲ¢·¢ÐÔ¡£±¾ÎÄÑÝʾÁËÈçºÎÀûÓÃQueueÕâÖÖÊý¾Ý½á¹¹ÊµÏÖÒ»¸ö¼òµ¥µÄThread»º³å³Ø¡£
Ò»¸öThread»º³å³Ø¿ÉÒÔÉè¼Æ³ÉÒÔÏÂÕâÑù£º»º³å³ØÓɼ¸¸ö¹¤×÷ThreadºÍÒ»¸öQueue×é³É£¬Client¸ºÔð°ÑÈÎÎñ·Åµ½QueueÀïÃ棨put·½·¨£©£¬¶ø¹¤×÷Thread¾ÍÒÀ´ÎÈ¡³öÕâЩÈÎÎñ²¢Ö´ÐÐËüÃÇ£¨get· ......

JavaÒì³£´¦Àí

Äã¾õµÃ×Ô¼ºÊÇÒ»¸öJavaר¼ÒÂð£¿ÊÇ·ñ¿Ï¶¨×Ô¼ºÒѾ­È«ÃæÕÆÎÕÁËJavaµÄÒì³£´¦Àí»úÖÆ£¿ÔÚÏÂÃæÕâ¶Î´úÂëÖУ¬ÄãÄܹ»Ñ¸ËÙÕÒ³öÒì³£´¦ÀíµÄÁù¸öÎÊÌâÂð£¿
OutputStreamWriter out = ...;
java.sql.Connection conn = ...;
try { // ¢É
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select uid, nam ......

java´úÂëÖ´ÐÐmysqlµÄÊý¾Ý±¸·ÝºÍÅúÁ¿Êý¾Ý²åÈ룡

mysqlÊý¾Ý¿â±¾ÉíÓÐÊý¾Ý±¸·ÝºÍÅúÁ¿Êý¾Ý²åÈëµÄÃüÁjava´úÂë¿ÉÖ´ÐÐÕâЩÃüÁî¡£
°²×°mysqlºó£¬ÐèÒªÉèÖû·¾³±äÁ¿£ºÎҵĵçÄÔÓÒ»÷--ÊôÐÔ--¸ß¼¶--»·¾³±äÁ¿£¬Ôö¼ÓMYSQL_HOME=“mysql°²×°Â·¾¶”£¬È»ºópath=%MYSQL_HOME%\bin
´úÂëÈçÏ£º
import java.io.BufferedReader;
import java.io.FileInputStream;
import java. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ