Êý¾Ýת»»excelµÄjava³ÌÐò
ÒªÓõ½jxlµÄ°ü
¾ßÌåʵÀý
1.Éú³ÉexcelÎļþ
package com.createexcel;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.mysql.jdbc.ResultSetMetaData;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import com.bean.DataInfo;
public class CreateExcel {
public void CreateExcel(String targetfile,String start,String end) {
String worksheet = "ÈÕÖ¾Êä³ö"; //Êä³öµÄexcelÎļþ¹¤×÷±íÃû
GetDataInfo data=new GetDataInfo();
List list=new ArrayList();
list=data.getdata(start,end);
if(list.size()!=0){
int colCount=0;
TestDao test=new TestDao();
ResultSet rs = test.selectSql("SELECT * from datainfo");
WritableWorkbook workbook;
try{
System.out.println("begin");
//´´½¨¿ÉдÈëµÄExcel¹¤×÷±¡,ÔËÐÐÉú³ÉµÄÎļþÔÚtomcat/binÏÂ
//workbook = Workbook.createWorkbook(new File("output.xls"));
OutputStream os=new FileOutputStream(targetfile);
workbook=Workbook.createWorkbook(os);
WritableSheet sheet = wo
Ïà¹ØÎĵµ£º
41¡¢ÊÇ·ñ¿ÉÒԼ̳ÐStringÀà?
StringÀàÊÇfinalÀà¹Ê²»¿ÉÒԼ̳С£
42¡¢swtichÊÇ·ñÄÜ×÷ÓÃÔÚbyteÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚlongÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚStringÉÏ?
switch£¨expr1£©ÖУ¬expr1ÊÇÒ»¸öÕûÊý±í´ïʽ¡£Òò´Ë´«µÝ¸ø switch ºÍ case Óï¾äµÄ²ÎÊýÓ¦¸ÃÊÇ int¡¢ short¡¢ char »òÕß byte¡£long,st ......
µ¥Ì¬¶¨Òå:
SingletonģʽÖ÷Òª×÷ÓÃÊDZ£Ö¤ÔÚJavaÓ¦ÓóÌÐòÖУ¬Ò»¸öÀàClassÖ»ÓÐÒ»¸öʵÀý´æÔÚ¡£
Singletonģʽ¾ÍΪÎÒÃÇÌṩÁËÕâÑùʵÏֵĿÉÄÜ¡£Ê¹ÓÃSingletonµÄºÃ´¦»¹ÔÚÓÚ¿ÉÒÔ½ÚÊ¡Äڴ棬ÒòΪËüÏÞÖÆÁËʵÀýµÄ¸öÊý£¬ÓÐÀûÓÚJavaÀ¬»ø»ØÊÕ£¨garbage col ......
package ch01;
public class BubbleSort
{
public static void main(String[] args){
int[] values ={
&n ......
Java¹æÔòÒýÇ湤×÷ÔÀí¼°ÆäÓ¦ÓÃ
¡¡¡¡Õª Òª Java¹æÔòÒýÇæÊÇÒ»ÖÖǶÈëÔÚJava³ÌÐòÖеÄ×é¼þ£¬ËüµÄÈÎÎñÊǰѵ±Ç°Ìá½»¸øÒýÇæµÄJavaÊý¾Ý¶ÔÏóÓë¼ÓÔØÔÚÒýÇæÖеÄÒµÎñ¹æÔò½øÐвâÊԺͱȶԣ¬¼¤»îÄÇЩ·ûºÏµ±Ç°Êý¾Ý״̬ϵÄÒµÎñ¹æÔò£¬¸ù¾ÝÒµÎñ¹æÔòÖÐÉùÃ÷µÄÖ´ÐÐÂß¼£¬´¥·¢Ó¦ÓóÌÐòÖжÔÓ¦µÄ²Ù×÷¡£
¡¡¡¡ÒýÑÔ
¡¡¡¡Ä¿Ç°£¬JavaÉçÇøÍƶ¯²¢·¢Õ¹Á ......
½ñÌìÏë¶ÁÈ¡srcϵÄÅäÖÃÎļþ£¬ÒÔǰһֱûÕÒµ½·½·¨£¬½ñÌìÑо¿ÁËÏÂÖÕÓÚOKÁË
System.out.println("path1:" + getClass().getResource("config.xml").getPath());
System.out.println("path2:" + getClass().getClassLoader().getResource("config.xml").getPath());
path1:/D:/DJ/workspace/.metadata ......