Time of Update: 2018-07-19
下面的代碼,可以讓你的程式變化表徵圖 Bitmap icon=Bitmap.getBitmapResource("icon/unread.gif"); net.rim.blackberry.api.homescreen.HomeScreen.updateIcon(icon,1); 但是這還不夠酷,能在表徵圖上面加數字呢。數字用來指示有幾個待辦, 或者是氣溫多少。 把上面的代碼改良一下: Bitmap
Time of Update: 2018-07-19
一個沒有並發控制的計數器: public class Counter implements Runnable {private static int count;public void run() {System.out.println(Thread.currentThread().getName() + ":" + (++count));}public static void main(String[] args){Counter counter = new
Time of Update: 2018-07-19
一、作為開關 a. AtomicBoolean private AtomicBoolean update = new AtomicBoolean(false);public void init(){ if( this.update.compareAndSet(false, true) ) { try{// do some thing } finally{this.refresh.set(false); } }}b.
Time of Update: 2018-07-19
Time of Update: 2018-07-19
通過java書寫記錄檔,換行的實現: 提供書寫記錄檔的方法: /*** 寫log檔案* @param string* @param file*/public static void writelogfile(String string, File file) {FileWriter fw = null;try {fw = new FileWriter(file);fw.write(string);} catch (IOException e)
Time of Update: 2018-07-19
在項目中產生日誌是一個項目所必須的,現在用的比較廣泛,比較流行的日誌工具 就有 log4j ;這個日誌工具其實使用起來是很方便的; 我對她的瞭解也是深,但當初在需要使用的時候真的是手足無措,知道怎麼配置但就是不知道怎麼用,浪費了很多時間 ; 今天就是寫一個快速入門的使用方法,希望能讓你有個快速入門的方法;做程式員的第一目標是什麼。 當然就是要實現你的想法,把
Time of Update: 2018-07-19
轉自: http://www.cnblogs.com/fczjuever/archive/2013/04/07/3005997.html 1. 闡述 對於Java中Map的遍曆方式,很多文章都推薦使用entrySet,認為其比keySet的效率高很多。理由是:entrySet方法一次拿到所有key和value的集合;而keySet拿到的只是key的集合,針對每個key,都要去Map中額外尋找一次value,從而降低了總體效率。那麼實際情況如何呢。
Time of Update: 2018-07-19
方法一、SpringMVC整合Shiro (Shiro是強大的許可權管理架構) http://www.360doc.com/content/14/0529/09/11298474_381916189.shtml 方法二、基於角色的存取權限控制 基於角色的存取權限控制 廢話少說,理論的東西不想多說了,網上一大把,我來點實際的。 首先基於角色的存取權限控制,所有的使用者訪問都會經過過濾,然後分析存取權限加以認證。 許可權中的重點,表的設計。
Time of Update: 2018-07-19
java中properties屬性檔案的讀寫修改操作 1、設定檔:config.propertis lOCAL_DRIVER=com.microsoft.sqlserver.jdbc.SQLServerDriver LOCAL_URL=jdbc:sqlserver\://lcoalhost:1433;databaseName=資料庫名 LOCAL_USER=使用者 LOCAL_PWD=密碼 2、讀取修改設定檔,只是將key的值修改:
Time of Update: 2018-07-19
需求很簡單,就是有兩個List A和B,它們有重複的部分,怎麼去重後合并在一起,好,那我們開始思考。 然而我的第一反應居然是遍曆判斷,百度搜了一下後發現我的java真是白學了。。。List是內建的方法都沒仔細研究,好吧,解決方案如下: A.removeAll(B); A.addAll(B); 好吧,自卑完開始實踐,但是呢,還是有點小問題出現了。
Time of Update: 2018-07-19
//3、輸入某年某月某日,判斷這一天是這一年的第幾天。 import java.util.Scanner; public class Year{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int ye =0, mon = 1, day = 1; int i ; int to = 0; int a[]={
Time of Update: 2018-07-19
BlackBerry Java程式開發,User Agent是需要手工設定,這樣更靈活。 首先使用System.getProperty("browser.useragent")獲得User Agent資料如下: 例如:"Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/5
Time of Update: 2018-07-19
適用的業務情境:1)當需要開啟多線程向資料庫批量插入業務資料完成後;2)這些新插入的資料需要從資料庫讀取並重新處理(如:分配給其它業務員做跟進業務);這些情況下,需要1)步完成,2)步才能執行查詢。即:1)線程組未執行完時,2)任務會一直阻塞 一、開啟多線程、等待線程,await()相當於等待設定的線程組完成後才執行相應操作 public class TestController extends BasicController { &
Time of Update: 2018-07-19
題目: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You may not engage in multiple transactions at the same
Time of Update: 2018-07-19
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.net.Socket; import java.net.SocketException; import java.net.UnknownHostException; import org.apache.commons.logging.Log;
Time of Update: 2018-07-19
1. Thread和Runnable介面的區別 Thread為類,只能單繼承,Runnable為介面,可以多繼承。Runnable作為參數傳遞給thread可以實現資源共用。 2.變數安全 方法內的變數為安全執行緒,執行個體變數為非安全執行緒。 3.判斷線程是否中斷 interrupt: 會清除狀態 isInterrupt:不會清除狀態 4
Time of Update: 2018-07-19
通過運用ArrayList類和和HashMap類及其中重要方法,對學生資訊進行管理,實現對學生資訊的增、刪、改、查操作。 1、Student學生資訊類 public class Student {private int stuNo;//學號private String stuName;//姓名private String classNo;//班級號public Student(){}public String getClassNo() {return
Time of Update: 2018-07-19
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class MyEclipseGen { private static final String LL = "Decompiling this copyrighted software is a violation of both your
Time of Update: 2018-07-19
/** * java繪圖的基本原理:畫一個圓 * @author tfq * @date 2011-08-27 */ import javax.swing.*; import java.awt.*; public class DrawCicle extends JFrame{ MyPanel mp=null; public static void main(String[]
Time of Update: 2018-07-19
package binary; public class Person { private String lastName; private String firstName; private int age; public Person(String ln,String fn,int age){ this.lastName=ln;