Time of Update: 2015-06-16
標籤:需要學習java,記錄從。net到java的筆記。 下載jar包首先針對於不同的資料庫需要下載相應的jar包。類似於.net 中串連不同資料庫的dll,只是.net直接在framework裡麵包含了,這個需要自己到對應的官網上下載。主要包:import com.mysql.jdbc.Connection;import com.mysql.jdbc.PreparedStatement; import java.sql.DriverManager;import
Time of Update: 2015-06-16
標籤:Constants.java 是一些介面測試中的URL和參數等。public class Constants { public static final String BASE_URL = "http://192.168.1.116:8080/cloudalbums/website/"; /** * 登入模組 */ //登入介面 public static final String LOGIN_URL = BASE_URL + "user/
Time of Update: 2015-06-16
標籤:設計模式就是一組成熟的解決方案 簡單原廠模式解決下列問題:提供一個建立對象執行個體的功能,而無須關係其具體實現.被建立執行個體的類型可以是介面/抽象類別/具體類. 優點: 1.協助封裝 &
Time of Update: 2015-06-17
標籤:金山公司面試題:一個字串中可能包含a~z中的多個字元,如有重複,如String
Time of Update: 2015-06-16
標籤:/** * @author Edwin Chen * *///定義節點class Node { //儲存字串 char storeChar; //是否完成單詞 boolean isComplete; Node leftChild,centerChild,rightChild; //構造方法 public Node(char storeChar,boolean isComplete) { this.storeChar =
Time of Update: 2015-06-16
標籤:package com.file.properties;import java.io.FileInputStream;import java.util.Properties;public class ReadProperties {Properties prop;public ReadProperties(String path) {prop = new Properties();try{FileInputStream fs = new
Time of Update: 2015-06-16
標籤:1.分頁實現 分頁實現是將所有查詢結果儲存在session對象或集合中,翻頁時從session對象或集合中取出一頁所需的資料顯示。但是這種方法有兩個最主要的缺點:一是使用者看到的可能是到期資料;二是如果資料量非常大,查詢一次資料集會耗費很長時間,並且儲存的資料也會佔用大量記憶體,效果明顯下降。2.實現資料分頁顯示的步驟
Time of Update: 2015-06-16
標籤:/** * @Descriptionmap 將圖片檔案轉化為位元組數組字串,並對其進行Base64編碼處理 * @author temdy * @Date 2015-01-26 * @param path 圖片路徑 * @return */public static String imageToBase64(String path) {// 將圖片檔案轉化為位元組數組字串,並對其進行Base64編碼處理 byte[] data = null; // 讀取圖片位元組數組
Time of Update: 2015-06-16
標籤: The LogRecord class wraps the messages logged to a Logger. You can either log a LogRecord directly to aLogger, or have the Logger wrap what is logged in a LogRecord. That is, all logging methods on
Time of Update: 2015-06-16
標籤:java 容器 Java集合架構是Java語言的重要組成部分,它包含了系統而完整的集合層次體系,封裝了大量的資料結構的實現,深刻理解Java集合架構的組成結構及其中的實作類別和演算法,可以極大的提高程式員編碼的能力。一、概念 又稱容器,是一個對象,能將具有相同性質的多個元素彙集成一個整體。集合架構被用於儲存,擷取,操縱和傳輸彙總的資料。二、成員介紹
Time of Update: 2015-06-16
標籤: You can set a Filter on a Logger. A Filter can filter out log messages, meaning decide if the message gets logged or not. Filters are represented by the Java interface java.util.logging.FilterHere is an example
Time of Update: 2015-06-16
標籤:匿名內部類也就是沒有名字的內部類正因為沒有名字,所以匿名內部類只能使用一次,它通常用來簡化代碼編寫但使用匿名內部類還有個前提條件:必須繼承一個父類或實現一個介面 執行個體1:不使用匿名內部類來實現抽象方12345678910111213141516abstract class Person
Time of Update: 2015-06-16
標籤:1、解壓縮package zuo.file.zip.unzip;import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File;import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader;
Time of Update: 2015-06-15
標籤:用插入排序對鏈表排序解題思路:最省時間的方法是使用優先順序隊列,但是無法通過,那就直接插入排序好了。 public ListNode insertionSortList(ListNode head) {ListNode root = new ListNode(Integer.MIN_VALUE);while (head != null) {ListNode temp = root;while (temp.next != null && head.val >=
Time of Update: 2015-06-16
標籤: 異常處理是程式設計中一個非常重要的方面,也是程式設計的一大痛點,從C開始,你也許已經知道如何用if...else...來控制異常了,也許是自發的,然而這種控制異常痛苦,同一個異常或者錯誤如果多個地方出現,那麼你每個地方都要做相同處理,感覺相當的麻煩! Java語言在設計的當初就考慮到這些問題,提出異常處理的架構的方案,所有的異常都可以用一個類型來表示,不同類型的異常對應不同的子類異常(這裡的異常包括錯誤概念),定義異常處理的規範,在1.4版本以後增加了異常鏈機
Time of Update: 2015-06-15
標籤:將一個整數中的數字進行顛倒,當顛倒後的整數溢出時,返回 0 (標記為 32 位整數)。解題思路:JAVA實現如下: public int reverseInteger(int n) {Boolean isNeg = n >= 0 ? false : true;StringBuilder sb = new StringBuilder(n+"");if (isNeg)sb.delete(0, 1);sb = sb.reverse();long res = 0;for (int i
Time of Update: 2015-06-15
標籤:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return whether the stack is empty.Notes:You must use only
Time of Update: 2015-06-15
標籤: int -> Stringint i=12345;String s="";第一種方法:s=i+"";第二種方法:s=String.valueOf(i);這兩種方法有什麼區別呢?作用是不是一樣的呢?是不是在任何下都能互換呢?String -> ints="12345";int
Time of Update: 2015-06-16
標籤: Java Input OutputThis tutorial explains how to read and write files via Java. Table of Contents1. Java I/O (Input / Output) for files1.1. Overview1.2. Reading a file in Java1.3. Writing a file in Java1.4. How to identify the current
Time of Update: 2015-06-16
標籤:今天看到兩個面試題,居然都做錯了。通過這兩個面試題,也加深對三目運算是的自動類型轉換的理解。題目1.以下代碼輸出結果是()。public class Test {public static void main(String[] args) {int a=5;System.out.println("value is :"+((a<5)?10.9:9)); }}A.編譯錯誤 B.10.9