Time of Update: 2018-12-07
請注意,當使用 runnable 介面時,您不能直接建立所需類的對象並運行它;必須從 Thread 類的一個執行個體內部運行它。許多程式員更喜歡 runnable 介面,因為從 Thread 類繼承會強加類層次。程式碼範例如下:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package job;import java.io.FileWriter;
Time of Update: 2018-12-07
數組類Array。是JAVA中最基本的一個儲存結構。它用於儲存一組連續的對象或基本類型的資料。其中的元素的類型必須相同。array是最有效率的一種。1、效率高,但容量固定且無法動態改變。 array還有一個缺點是,無法判斷其中實際存有多少元素,length只是告訴我們array的容量。 2、JAVA中有一個Arrays類,專門用來操作array ,提供搜尋、排序、複製等靜態方法。 equals():比較兩個array是否相等。array擁有相同元素個數,且所有對應元素兩兩相等。
Time of Update: 2018-12-07
如果你找的javascript的東西的話,建議你 ctrl+F 直接在這個頁上找,因為這裡80%有你要找的,但是要讓你挨著看的話,你就準備看完就去配眼鏡!! 事件來源對象 event.srcElement.tagName event.srcElement.type 捕獲釋放 event.srcElement.setCapture(); event.srcElement.releaseCapture(); 事件按鍵 event.keyCode event.shiftKey
Time of Update: 2018-12-07
這一塊裡面,標識符比較簡單,沒有什麼需要記錄的東西. 主要做下Java基礎資料型別 (Elementary Data Type)的筆記吧. Java有四種基礎資料型別 (Elementary Data Type): 1. 邏輯型(布爾型) Boolean類型只有兩個值,分別是true和false. 在Java中不能像C/C++一樣,使用0/1來表示true/false! 2. 字元型 Char類型,
Time of Update: 2018-12-07
這一部分需要再強調的東西不多,因為運算子運算式都是平時最常用的東西了.總結了一下,以下一點還需要略微注意一下. 關係運算子主要有: >, <, >=, <=, == , !=這幾個. 需要注意的是: 關係運算子返回的是布爾值(boolean),而布爾值只有true和false兩種值(絕對沒有0/1這樣C/C++的遺傳), 因此關係運算的結果可以用boolean變數接收. 如: int i = 10;int j =
Time of Update: 2018-12-07
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//替換字元 public static String replace(String inString, String oldPattern, String newPattern) { if(inString == null) return null;
Time of Update: 2018-12-07
這一部分同樣比較熟悉了,但switch語句的使用還需要注意一下.public class Chose{public static void main(String args[]){int grade = 3;switch(grade){case 3 :System.out.println("成績優秀!");break;case 2 :System.out.println("成績及格!");break;case 1 :System.out.println("需要重修!");break;
Time of Update: 2018-12-07
FormatDate.java package com.ucit.ca.webApp.tool;import java.util.*;import java.text.*;public class FormatDate {public FormatDate() {}// 格式化日期為字串 "yyyy-MM-dd hh:mm"public String formatDateTime(Date basicDate, String strFormat) {SimpleDateFormat df =
Time of Update: 2018-12-07
clone方法是用來複製一個對象。不同於“=”。對於實值型別的資料是可以通過“=”來實現複製的。但是對於參考型別的對象,“=”只能複製其記憶體位址,使對象的引用指向同一個對象,而不會建立新的對象。clone則可以建立與原來對象相同的對象。舉個例子:有一個Car類Car c1 = new Car();Car c2 = c1;這兩句事實上只建立了一個對象。只不過c1和c2指向了同一個對象。如果上面的兩句改為:Car c1 = new Car();Car c2 =
Time of Update: 2018-12-07
java代碼: System.out.println(this.getClass().getClassLoader().getResource(".").getPath()); System.out.println(this.getClass().getResource("").getPath()); System.out.println(this.getClass().getResource("/").getPath()); 運行結果:/D:/apa
Time of Update: 2018-12-07
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->public class HttpClientMain { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub
Time of Update: 2018-12-07
/*** 將一個字串轉化為輸入資料流*/public static InputStream getStringStream(String sInputString){if (sInputString != null && !sInputString.trim().equals("")){try{ByteArrayInputStream tInputStringStream = new
Time of Update: 2018-12-07
import java.io.*;import java.util.zip.*; public class raintime{ public static void main(String[] args){ try{ BufferedReader in=new BufferedReader( new InputStreamReader(new FileInputStream(args[0]),"
Time of Update: 2018-12-07
The conclusion comes like that:The current path (./)is stands for the project location.(see pic 1: Location) How can we set the path of the log file accurately in log4j.properties?Such as there is a web project which I created in eclipse.Detail info
Time of Update: 2018-12-07
以下三個的名稱應該一致1 國際化檔案 messages_en_US.propertieshr.viewPersonalInfo.Hobby_interest=Hobby/interest2 JSP EL 運算式標籤名稱<td class="td_title"> <spring:message code="hr.viewPersonalInfo.Hobby_interest" /> <!-- Hobby_interest -->
Time of Update: 2018-12-07
於eclipse 伺服器內啟動tomcat伺服器運行web項目,出現如題異常.java.lang.ClassNotFoundException資訊: Set web app root system property: 'webapp.root' = [F:\work_space_Soft\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\lottes_03_14\]2013-5-31 3:14:43
Time of Update: 2018-12-07
方法1:修改/etc/profile 檔案所有使用者的 shell都有權使用這些環境變數<1>在 shell終端執行命令:vi /etc/profile<2>在 profile檔案末尾加入:JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15PATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar: $JAVA_HOME/lib/tools.jarexport JAVA_HOME,
Time of Update: 2018-12-07
(概念原理)Java IO學習筆記:概念與原理 一、概念 Java中對檔案的操作是以流的方式進行的。流是Java記憶體中的一組有序資料序列。Java將資料從源(檔案、記憶體、鍵盤、網路)讀入到記憶體
Time of Update: 2018-12-07
A.不使用遞迴:import java.io.File;import java.util.LinkedList;public class FileSystem { public static void main(String[] args) { long a = System.currentTimeMillis(); LinkedList list = new LinkedList(); File dir =
Time of Update: 2018-12-07
屬性檔案(.properties)內容格式 driver=com.mysql.jdbc.Driverurl=jdbc:mysql://localhost:3306/mydbuser=root password=111characterEncoding=gb2312 屬性檔案的載入 Code highlighting produced by Actipro CodeHighlighter