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

Java±à³ÌÄÇЩʶù2_·½·¨

Java±à³ÌÄÇЩʶù52—·½·¨ÉùÃ÷
µÚÆßÕÂ ·½·¨
·½·¨µÄÀ´Ô´
·½·¨µÄ¸ÅÄîÀ´Ô´ÓÚÊýѧÉϵĺ¯Êý£¬ÔÚÊýѧÖУ¬µ±Êý¾Ý¾ßÓÐÒ»¶¨µÄ¹æÂÉʱ£¬¾ÍÊÇÓÃÒ»¸öº¯ÊýÀ´´úÂë¸ÃÊý×ֵĹæÂÉ£¬ÀýÈçf£¨n£©=nÔò´ú±í1¡¢2¡¢3¡¢……ÕâÑùµÄÒ»¸öÊýÁС£ÔÚÊýѧÉÏnÊDzÎÊý£¬¶ÔÓÚÈ·¶¨µÄnÖµÖ»ÓÐÒ»¸öf£¨n£©µÄÖµºÍËü¶ÔÓ¦
·½·¨ÊÇÒ»×éΪÁËʵÏÖÌض¨¹¦ÄܵĴúÂë¿éµÄ¼¯ºÏ¡£·½·¨ÔÚÓï·¨ÉϵŦÄÜÖ÷ÒªÓÐÒÔÏÂÁ½¸ö£º
    l½á¹¹»¯´úÂë
    ½«´úÂë°´ÕÕ¹¦ÄܽøÐÐ×éÖ¯£¬Ê¹´úÂëµÄ½á¹¹±È½ÏÇåÎú£¬ÈÝÒ×ÔĶÁºÍÐ޸ģ¬Ò²¾ÍÊdzÌÐòµÄ¿Éά»¤ÐÔÇ¿¡£
    l¼õÉÙ´úÂëÖظ´
    Ò»¸ö¹Ì¶¨µÄ¹¦ÄÜ£¬¿ÉÄÜ»áÔÚ³ÌÐòÖжà´ÎʹÓã¬ÔÚʹÓÃʱֻÐèÒªµ÷ÓÃдºÃµÄ·½·¨£¬¶ø²»ÓÃÖظ´Êéд¶ÔÓ¦µÄ¹¦ÄÜ´úÂë¡£
    ·½·¨ÔÚÊéдʱÐèҪעÒâÒÔÏÂÁ½µã£º
    lÂß¼­ÑϽ÷
    ·½·¨ÊµÏÖµÄÒ»¸öÍêÕûµÄ¹¦ÄÜ£¬ËùÒÔÔÚÊéдʱҪ¿¼Âǵ½¸÷ÖÖ¿ÉÄܵÄÇé¿ö£¬²¢¶ÔÿÖÖÇé¿ö×ö³öÇ¡µ±µÄ´¦Àí¡£
    lͨÓÃÐÔÇ¿
    ·½·¨ÊµÏÖµÄÊÇÒ»ÖÖ¹¦ÄÜ£¬ÔÚʵ¼ÊʵÏÖʱ£¬¿ÉÒÔ¸ù¾ÝÐèÒª£¬Ê¹·½·¨¾ß±¸Ò»¶¨µÄͨÓÃÐÔ£¬³ý·Ç±ØÒª£¬·ñÔò²»ÒªÐ´×¨Óõķ½·¨¡£
    ÔÚJavaÓïÑÔÖУ¬Ç¡µ±µÄʹÓ÷½·¨£¬½«Ê¹³ÌÐò¸ü¼ÓÓÅÑÅ£¬±ãÓÚÔĶÁºÍʹÓá£ÏÂÃæ¾ÍÀ´½éÉÜ·½·¨ÉùÃ÷µÄÓï·¨¸ñʽ¡£
·½·¨ÉùÃ÷£¬¾ÍÊÇÉùÃ÷Ò»ÖÖÐµĹ¦ÄÜ£¬»òÕß˵´´ÔìÒ»ÖÖÐµĹ¦ÄÜ¡£ÀýÈçÒÔÏÂÊÇÒ»¸öÇóintÊý¾Ý¾ø¶ÔÖµµÄ·½·¨ÉùÃ÷´úÂ룺
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ publicintabs(int n){
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(n > 0){
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ return n;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }else{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ return –n;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
    ÕâÀï¾ÍʵÏÖÁËÇóintÖµ¾ø¶ÔÖµµÄ¹¦ÄÜ£¬ÎªÁËʹ¸Ã¹¦ÄÜͨÓã¬Ê¹ÓÃÒ»¸ö²ÎÊýn´ú±íÐèÒªÇó¾ø¶ÔÖµµÄÊýÖµ£¬ÔÚ·½·¨ÄÚ²¿Ê¹ÓÃÇó¾ø¶ÔÖµµÄÂß¼­£ºÕýÊýµÄ¾ø¶ÔÖµÊÇ×ÔÉí£¬¸ºÊýµÄ¾ø¶ÔÖµÊÇÏà·´Êý£¬Ê¹ÓÃreturnÓï¾ä½«·½·¨ÔËËãµÄ½á¹û·µ»Ø¡£
¾ßÌå·½·¨ÉùÃ÷µÄÓï·¨¸ñʽÈçÏ£º
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ·ÃÎÊ¿ØÖÆ·û[ÐÞÊηû]·µ»ØÖµÀàÐÍ·½·¨Ãû³Æ(²ÎÊýÁбí){
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ·½·¨Ìå
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
1¡¢·ÃÎÊ¿ØÖÆ·û
    ·ÃÎÊ¿ØÖÆ·ûÏÞ¶¨·½·¨µÄ¿É¼û·¶Î§£¬»òÕß˵ÊÇ·½·¨±»µ÷Óõķ¶Î§¡£·½·¨µÄ·ÃÎÊ¿ØÖÆ·ûÓÐËÄÖÖ£¬°´¿É¼û·¶Î§´Ó´óµ½Ð


Ïà¹ØÎĵµ£º

ÓйØjavaÖÐresultSetµÄÎÊÌâ

//´òÓ¡³ömess±íµÄÁÐÊýÊǶàÉÙ
public static void main(String[] args){
  String sql="select count(*) from mess";
  ResultSet set=null;
  try {
   Object paramValues[] = new Object[0];
         set = DBUtil.preExec ......

JAVA:ÓöàÏß³ÌʵÏÖʱ¼äµÄ¶¯Ì¬ÏÔʾ

import java.awt.*;
import javax.swing.*;
import java.util.Date;
import java.awt.*;
class Time extends JFrame implements Runnable{//ʵÏÖ½Ó¿Ú
Thread clockThread;
   JLabel jLabel=new JLabel();
   public Time()
   {
   Container con=this.getContentPane() ......

Java֮staticѧϰ

¶ÔÓÚѧϰstaticÎÒÃÇÏÈÀ´¿´Á½¸öÀý×Ó£º
//Example 1 Tst.java£¬no main() method
package com.blogchina.qb2049;
public class Tst
{
static { System.out.println("111111"); }
}
ÔËÐнá¹ûΪ: 111111
Exception in thread "main" java.lang.NoSuchMethodError: main
ͬÑùµÄµÀÀí¿´µÚ¶þ ......

javaÖйØÓÚʱ¼äÈÕÆÚ²Ù×÷µÄ³£Óú¯Êý

1.¼ÆËãijһÔ·ݵÄ×î´óÌìÊý
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year);
time.set(Calendar.MONTH,i-1);//×¢Òâ,Calendar¶ÔÏóĬÈÏÒ»ÔÂΪ0            
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//±¾Ô·ݵÄÌìÊý ......

JavaÐéÄâ»ú ºÍ javaÐéÄâ»úϵĽø³Ì

Ò»¡¢Ê²Ã´ÊÇJavaÐéÄâ»ú
     µ±Äã̸µ½JavaÐéÄâ»úʱ£¬Äã¿ÉÄÜÊÇÖ¸£º
     1¡¢³éÏóµÄJavaÐéÄâ»ú¹æ·¶
     2¡¢Ò»¸ö¾ßÌåµÄJavaÐéÄâ»úʵÏÖ
     3¡¢Ò»¸öÔËÐеÄJavaÐéÄâ»úʵÀý
¶þ¡¢JavaÐéÄâ»úµÄÉúÃüÖÜÆÚ
     Ò»¸öÔËÐÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ