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

JavaдµÄ̰³ÔÉß

     ÈýÖÜǰ£¬¾ÍÓëͬѧԼ¶¨ºÃÁË£¬»¨ÈýÖÜʱ¼äд¸ö̰³ÔÉߣ¬¾ÍÓÃ×Ô¼ºÏÖÔÚËùѧµÄJava£¬ÎÒÏë¿ÉÒÔ°¡¡£Ñ§Ð£Àï½Ì²»³öʲô¶«Î÷£¬ÄǾÍ×Ô¼º¸ã°É£¡ÓÚÊÇÎÒÃÇÐÅÊĵ©µ©¿ªÊ¼Á˼¸Ìì¡£²»ÁÏÎåÒ»Ò»À´£¬°ÑËùÓеͼÀ­ÏÂÁË¡£×îºóÒ»ÖÜÁË£¬Ã»°ì·¨£¬Í¨Ïü°É£¡ÓÚÊÇÁ¬Ðø¼¸Ìì¿à¸É£¬ÖÕÓÚд³öÀ´ÁË.ËäÈ»Óеã´Ö²Ú£¬ÒòΪѧУ»¹Ã»¿ªÊ¼½ÌGUIºÍỊ̈߳¬ÒÔºóÎÒ»á¸ÄÉÆÕâ´úÂëµÄ
import java.awt.*;
import java.awt.event.*;
import java.util.*;
//===================¸ÃÀàÊÇ¿ØÖÆÉßÒÆ¶¯µÄ´°¿Ú===================================================
class snakeCanvas extends Panel implements Runnable, KeyListener
{
 private Label b[] ;  //ÉßµÄÖ÷Ìå
 private Button food ;  // ʳÎï
 private Thread thread;  //Ïß³Ì
 private int count = 1, i;  //count±íʾÉßµÄÊýÁ¿
 private int xFood, yFood ; //±íʾʳÎïµÄ×ø±ê 
 private int x = 5, y = 0; //¿ØÖÆÉßÍ·µÄ×ø±ê
 private boolean  up = false, down = false, right = true, left = false;  //ÓÃÀ´¿ØÖÆÉߵķ½Ïò
 private boolean Game = true ;  // ÅжÏÓÎÏ·ÊÇ·ñ½áÊø
 snakeCanvas()
 {
  setSize( 510, 515 );
  thread = new Thread(this);
  setLayout(null);
  setBackground(Color.green); //ÉèÖñ³¾°ÑÕÉ«
  
  b = new Label[50] ; 
  //¶ÔÉߵijõʼ»¯
  for ( int i = 0; i < 30; i++ )
  {
   b[i] = new Label("¿Ú") ;
   b[i].setSize( 10, 10 ) ;
  }
  b[0].setBounds(5, 0, 10, 10);
  add(b[0]); //Ìí¼Ó×é¼þ
  //====================ʳÎïµÄËæ»ú×ø±ê=================================
  xFood = 10*(int)( ( Math.random() + 0.01 ) * 50 ) + 5 ;
  yFood = 10*(int)( ( Math.random() + 0.01 ) * 50 )  ;
  
 }
 public void keyTyped( KeyEvent e){} 
 public void keyReleased(KeyEvent e){}
 //=========¼üÅÌʼþ=========================
 public void keyPressed(KeyEvent e)
 {
 &nbs


Ïà¹ØÎĵµ£º

JavaÊÖ²áÖÐjava.util.RandomµÄÃèÊö£¬Ëæ»úÊý²úÉúËã·¨


java.util
Àà Random
java.lang.Object

java.util.Random
ËùÓÐÒÑʵÏֵĽӿڣº

Serializable
Ö±½ÓÒÑÖª×ÓÀࣺ

SecureRandom
public class Random
extends Object
implements Serializable
´ËÀàµÄʵÀýÓÃÓÚÉú³ÉÎ±Ëæ»úÊýÁ÷¡£´ËÀàʹÓà 48 λµÄÖÖ×Ó£¬Ê¹ÓÃÏßÐÔͬÓ๫ʽ¶ÔÆä½øÐÐÐ޸ģ¨Çë²ÎÔÄ Donald Knuth µÄ ......

JAVA¶ÁÈ¡iniÎļþµÄÒ»¸öÀ࣬´æ×ÅÒÔ±¸ºóÓã¡

package com.qiao.java;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iter ......

Java»ñÈ¡¿Í»§¶ËÕæÊµIPµØÖ·µÄÁ½ÖÖ·½·¨

ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache£¬SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæÊµIPµØÖ·ÁË¡£
¡¡¡¡
Tag£ºJava ¿Í»§¶Ë ÕæÊµIPµØÖ·
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ ......

½«JAVAÖеÄÊý×éת»»³ÉJS µÄÊý×é

JAVA ´úÂëÈçÏ£º
<%
        //    µÃµ½Òª×ª»»µÄÊý×é---µ±È»ÕâÀïÒ²¿ÉÒÔÊÇÆäËûÀàÐ͵ÄÊý×é
        List jsList = (List) request.getAttribute("gczbh"); 
%>
JS  ´úÂëÈçÏ£º
<script type="text/javascrip ......

UbuntuÏÂjava»·¾³ÅäÖÃ

Ò»¡¢¸øUbuntuÅäÖÃJAVA»·¾³ 
¡¡ 
¡¡¡¡²Ù×÷ϵͳ°æ±¾£ºUbuntu 7.10 Gutsy 
¡¡ 
¡¡¡¡JAVA°æ±¾£ºJAVA 6 
¡¡ 
¡¡¡¡ÔÚUbuntuϰ²×°JAVAÐéÄâ»úºÍSDK£¨¿ª·¢°ü£©ÊǷdz£ÇáËÉÈÝÒ׵ģº 
¡¡ 
¡¡¡¡ÁªÍøµÄÇé¿öÏÂÔÚÖÕ¶ËÏÂÊäÈëÃüÁî 
¡¡ 
¡¡¡¡$sudo apt-get& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ