随笔分类 -  java

摘要:依赖架包:pinyin4j.jar 阅读全文
posted @ 2016-12-30 16:06 N神3 阅读(245) 评论(0) 推荐(0)
摘要:public class Test { public static void main(String[] args) { Integer[] a = {1,2,3}; Integer[] b = {4,5,6}; Integer[] c = new Integer[a.length+b.length]; Sys... 阅读全文
posted @ 2016-11-28 09:34 N神3 阅读(1351) 评论(0) 推荐(0)
摘要:import java.util.ArrayList; import java.util.Date; import java.util.List; import net.sf.json.JSONObject; public class Test { public static void main(String[] args) { Mybean bean = new Test().new... 阅读全文
posted @ 2016-11-10 18:25 N神3 阅读(317) 评论(0) 推荐(0)
摘要:import org.apache.commons.beanutils.BeanUtils;public class Person { private String name; public String getName() { return name; } public void setName( 阅读全文
posted @ 2016-11-10 14:21 N神3 阅读(468) 评论(0) 推荐(0)
摘要://LinkedHashMap先入先出 public class Test { public static void main(String[] args) { Map map = new HashMap(); map.put("aaa", "111"); map.put("bbb", "222"); map.put("ccc", "333"); for(Entry e :map.entryS... 阅读全文
posted @ 2016-11-10 09:54 N神3 阅读(3353) 评论(0) 推荐(0)
摘要:public static void main(String[] args) throws IOException { System.out.print("Enter a number:"); Scanner in = new Scanner(System.in); boolean availabl 阅读全文
posted @ 2016-11-01 15:14 N神3 阅读(221) 评论(0) 推荐(0)
摘要:/*DbPro.class*/ public transient Record findFirst(String sql, Object paras[]{ List result = find(sql, paras); return result.size() DbKit.closeQuietly(rs, pst); return result; } /*RecordBu... 阅读全文
posted @ 2016-10-10 15:44 N神3 阅读(6837) 评论(0) 推荐(0)
摘要:1、<input type="submit" value="提交"> 将表单提交<form action="login.jsp"></form> 注意事项: 1.1、不要再加onclick<input type="submit" value="提交" onclick="submit();"> 1.2 阅读全文
posted @ 2016-08-26 18:46 N神3 阅读(196) 评论(0) 推荐(0)
摘要:/*文件64位编码*/ public static void main(String[] args) { byte[] fileByte = toByteArray(newFile); String imgStr = new BASE64Encoder().encode(fileByte); } 阅读全文
posted @ 2016-08-17 17:31 N神3 阅读(8056) 评论(0) 推荐(0)
摘要:List、Stack、Queue 阅读全文
posted @ 2016-07-21 09:00 N神3 阅读(578) 评论(0) 推荐(0)
摘要:public static void main(String arsg[]) throws Exception{ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream( 阅读全文
posted @ 2016-07-20 11:46 N神3 阅读(1253) 评论(0) 推荐(0)
摘要:transient List query(Config config, Connection conn, String sql, Object paras[]) throws SQLException { List result = new ArrayList(); PreparedStatement pst = conn.prepare... 阅读全文
posted @ 2016-07-15 11:20 N神3 阅读(448) 评论(0) 推荐(0)
摘要:public class Test{ //匹配替换掉order by之后的字符串 public static void main(String[] args) { Pattern pattern = Pattern.compile("order\\s+by\\s+[^,\\s]+(\\s+asc|\\s+desc)?(\\s*,\\s*[^,\\s]+(\\s+asc|\\s+desc)?)*"... 阅读全文
posted @ 2016-07-15 10:34 N神3 阅读(288) 评论(0) 推荐(0)
摘要:public class Test{ /**InfoImpl类具有getVar和setVar方法***/ public static void main(String arsg[]){ InfoImpl i = null; // 声明类对象 i = new InfoImpl(12) ; // 通过子 阅读全文
posted @ 2016-07-08 09:22 N神3 阅读(221) 评论(0) 推荐(0)
摘要:泛型 泛型:类型作为实参传给类或方法。 泛型声明:用一对尖括号<>声明。 标识符可以是任意字母表示确定类型。常用 T(type) E(element) K(key) V(value) ?通配符表示不确定类型,只有在运行时才知道其类型。 受限泛型:标识符受限泛型 和 ?通配符受限泛型 标识符受限泛型: 阅读全文
posted @ 2016-07-07 19:08 N神3 阅读(211) 评论(0) 推荐(0)
摘要:RandomAccessFile是用来访问那些保存数据记录的文件的,你就可以用seek( )方法来访问记录,并进行读写了。这些记录的大小不必相同;但是其大小和位置必须是可知的。但是该类仅限于操作文件 阅读全文
posted @ 2016-07-07 14:59 N神3 阅读(150) 评论(0) 推荐(0)
摘要:public class ClientSocket { public static void main(String args[]) { String host = "127.0.0.1"; int port = 8919; try { Socket client = new Socket(host 阅读全文
posted @ 2016-07-07 09:49 N神3 阅读(375) 评论(0) 推荐(0)
摘要:网络应用程序中使用多线程的地方非常多。 网络开发无非是搞自动化或信息化项目中的网络报文接收、系统间信息的桥接。【例如:servlet容器】 阅读全文
posted @ 2016-07-06 11:48 N神3 阅读(152) 评论(0) 推荐(0)
摘要:多线程使用场景 1、同时需要做两件以上事情时需要开多个线程(例如:上传功能附带进度条显示,一边做上传,一边更新进度条状态。) 2、大量同类型数据需要进行处理(导入导出大量数据) 3、office文档转换pdf比较慢 4、一个任务的执行进度,比如我们常看到的进度条,实现方式可以是在任务中加入一个整型属 阅读全文
posted @ 2016-07-06 10:57 N神3 阅读(228) 评论(0) 推荐(0)
摘要:1、request.setCharacterEncoding只对POST请求起作用。GET请求用new String(paramterData.getBytes("iso8859-1"),"UTF-8"); 2、response.setContentType指定HTTP 响应的编码,同时指定了浏览器 阅读全文
posted @ 2016-07-05 12:11 N神3 阅读(1427) 评论(0) 推荐(0)