Time of Update: 2018-12-04
1.用java.util.Calender來實現 Calendar calendar=Calendar.getInstance(); calendar.setTime(new Date()); System.out.println(calendar.get(Calendar.DAY_OF_MONTH));//今天的日期 calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+1);//
Time of Update: 2018-12-04
java隨機產生驗證碼,可以隨機產生數字、大寫字母、小寫字母。還可以隨機產生文字字型、及大小。在圖片上面可能字型都不不同、大小不等。 package com.hoo.util; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.util.Random; import
Time of Update: 2018-12-04
/** * 得到本月的第一天 * @return */ public static String getMonthFirstDay() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar
Time of Update: 2018-12-04
.1 java 入門的經典書是那些.2 怎樣開始學習java.3 java的開發工具是哪些? (what is the best fundamental books for java easy leaner? how to study the java ? and how and whatthe java tools would be in used should be the major main three questions for the javabeginner): To make
Time of Update: 2018-12-04
Introduction to Objects:The Progress of abstraction:.1 All of the programming language privide abstraction.Since all kinds of imperativelanguage is base on the assembly language , and, the assembly language is aabstraction of the underlying
Time of Update: 2018-12-04
public static ControllerConfig getControllerConfig(URL url) { ControllerConfig controllerConfig = (ControllerConfig) controllerCache.get(url); if (controllerConfig == null) { // don't want to block here synchronized
Time of Update: 2018-12-04
這三個方法都是java多線程編程中常用的方法,都是用來讓出當前線程的執行權,它們的區別如下:1、wait是Object對象的方法,sleep和yield是Thread對象的方法。2、wait會釋放當前線程佔用的鎖,並且必須在同步塊中調用,其他兩個方法不會釋放鎖,也不需要再同步塊中調用。3、wait可以使當前線程等待一段時間後重新執行,也可以一直等待直到其他線程調用notify/notifyAll喚醒當前線程後再執行。4、sleep使當前線程“睡眠”一段時間,從而讓其他線程擷取執行的機會,包括優先
Time of Update: 2018-12-04
一、基礎簡答題1. super()與this()的區別?super() 調用父類的無參構造方法,this()調用本身類無參構造方法。 2. 範圍public,protected,private,以及不寫時的區別?public公用 修飾的變數,在其他類都可以訪問到protected 保護 同一個包 子類訪問private 私人 只有這個類訪問不寫 package 同一個包訪問 3. 在JAVA中,如何跳出當前的多重嵌套迴圈?break;continue跳出當前迴圈;
Time of Update: 2018-12-04
1,什麼是antant是構建工具2,什麼是構建概念到處可查到,形象來說,你要把代碼從某個地方拿來,編譯,再拷貝到某個地方去等等操作,當然不僅與此,但是主要用來幹這個3,ant的好處跨平台
Time of Update: 2018-12-04
首先到poi的官網http://poi.apache.org/上下載最新版的poi包,目前最新版是3.9。操作excel需要用到如下幾個jar包:然後在java工程中匯入上述jar包。代碼如下:import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.io.InputStream;import
Time of Update: 2018-12-04
首先,我們需要在工程描述檔案default.properties中,添加一句話,啟用ProGuardproguard.config=proguard.cfgProguard就可以使用了。當我們正常通過Android Tools匯出Application
Time of Update: 2018-12-04
判斷字串相等我們經常習慣性的寫上if(str1==str2),這種寫法在java中可能會帶來問題。java中判斷字串是否相等有兩種方法:1、用“==”運算子,該運算子表示指向字串的引用是否相同,比如: String a="abc";String b="abc",那麼a==b將返回true。這是因為在java中字串的值是不可改變的,相同的字串在記憶體中只會存一份,所以a和b指向的是同一個對象;再比如:String a=new String("abc"); String b=new String("
Time of Update: 2018-12-04
Android 反射機制http://www.blogjava.net/zh-weir/archive/2011/03/26/347063.htmlhttp://www.cnblogs.com/Quincy/archive/2011/06/19/2084557.html延伸學習一:Android應用開發中如何使用隱藏APIhttp://www.blogjava.net/zh-weir/archive/2011/05/01/349360.html延伸學習二:動態代理為啥要說動態代理呢?看java.
Time of Update: 2018-12-04
本文將要介紹的是如何使用線程池來建立Socket服務,並支援大檔案的斷點續傳首先我們建立一個工具類:package com.android.server.util;import java.io.ByteArrayOutputStream;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import
Time of Update: 2018-12-04
區別一:sleep是Thread類的方法,是線程用來 控制自身流程的,比如有一個要報時的線程,每一秒中列印出一個時間,那麼我就需要在print方法前面加上一個sleep讓自己每隔一秒執行一次。就像個鬧鐘一樣。wait是Object類的方法,用來線程間的通訊,這個方法會使當前擁有該對象鎖的進程等待知道其他線程調用notify方法時再醒來,不過你也可以給他指定一個時間,自動醒來。這個方法主要是用走不同線程之間的調度的。區別二 :關於鎖的釋放
Time of Update: 2018-12-04
問題:從0列印到99約束:有三個線程 A、B、C,其中A列印0~4,B列印5~9,C列印10~14,然後A列印15到19,B列印20~24,以此類推首先,寫了一塊代碼,如下public class PrintThread extends Thread {private int id;private static Integer n = 0;public PrintThread(int id) {this.id = id;}@Overridepublic void run() {while (n
Time of Update: 2018-12-04
看了Tomcat的原始碼,發現Tomcat是通過Digester方式來解析server.xml的Catalina中:/** * Create and configure the Digester we will be using for startup. */protected Digester createStartDigester() { long t1=System.currentTimeMillis(); // Initialize the digester
Time of Update: 2018-12-04
Java虛擬機器使用某個類的過程,可分為七個階段:載入 - 驗證 - 準備 - 解析 - 初始化 - 使用 - 卸載本文只介紹在什麼情況下對類進行初始化。Java虛擬機器規範對何時進行類的初始化做了嚴格規範,有且只有四種情況:1. 虛擬機器啟動時,指定的主類。 包含main方法的類。2. 遇到new、getstatic、putstatic、invokestatic四條指令時。 new:使用new關鍵字執行個體化對象。 getstatic:讀引用一個類的靜態欄位。
Time of Update: 2018-12-04
轉載請標明出處:http://blog.csdn.net/xuefeng0707/article/details/9132339類載入的全過程分為五個階段:載入、驗證、準備、解析、初始化。1.
Time of Update: 2018-12-04
使用Java