读取网页的JAVA方法
import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
URL yahoo = new URL("网址");
BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
相关文档:
首先在公共类写好数据库连接和关闭方法:
public static Connection getConnection(){
Connection conn = null;
try {
Context ic = new InitialContext();
DataSource source = (DataSource)ic.lookup("java:comp/env/jdbc/ownHome");
conn = source.getConnection();
} catch (NamingExcepti ......
http://www.javaalmanac.com - Java开发者年鉴一书的在线版本. 要想快速查到某种Java技巧的用法及示例代码, 这是一个不错的去处.
http://www.onjava.com - O'Reilly的Java网站. 每周都有新文章.
http://java.sun.com - 官方的Java开发者网站 - 每周都有新文章发表.
http://www.developer.com/java - 由Gamelan.com 维 ......
java Map 遍历速度最优解
第一种:
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
效率高,以后一定要使用此种方式!
第二种:
Map map = ......
2010-03-18
package javaEcsl;
import java.io.*;
import java.util.*;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
/** */
/**
* <p>
* Title:
* </p>
* <div>Description: Excel数据导入到oracle数据库类. </div>
* <p>
* Copyright: Copyright (c) 200 ......
public class Test1 {
public static void main(String[] args) {
//assignment
byte bval1 = 1, bval2 = 2;
short sval1 = 1, sval2 = 2;
int ival1 = 1, ival2 = 2;
long lval1 = 1, lval2 = 2;
float fval1 = 1.0f, fval2 = 2.0f;
double dval1 = 1.0, dval2 = 2.0;
char cval1 = 'a' ......