摘要: byte char short int float double long boolean 阅读全文
posted @ 2014-05-26 20:03 一路向北中 阅读(149) 评论(0) 推荐(0)
摘要: JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build PathJSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http... 阅读全文
posted @ 2014-05-18 20:15 一路向北中 阅读(415) 评论(0) 推荐(0)
摘要: 1 public class ProperticesDemo { 2 @Test 3 public void test(){ 4 Properties pro = new Properties(); 5 try { 6 pro... 阅读全文
posted @ 2014-05-10 21:04 一路向北中 阅读(215) 评论(0) 推荐(0)
摘要: 1 @Test 2 public void test1(){ 3 try { 4 Date d1 = new SimpleDateFormat("yyyyMMdd").parse("20140101"); 5 Date... 阅读全文
posted @ 2014-05-09 09:05 一路向北中 阅读(405) 评论(0) 推荐(0)
摘要: public class TestDao { public void update() throws IOException { String url = TestDao.class.getClassLoader() .getResource("cn... 阅读全文
posted @ 2014-04-14 22:18 一路向北中 阅读(157) 评论(0) 推荐(0)
摘要: 1 public class ServletDemo3 extends HttpServlet { 2 3 public void doGet(HttpServletRequest request, HttpServletResponse response) 4 ... 阅读全文
posted @ 2014-04-14 21:52 一路向北中 阅读(205) 评论(0) 推荐(0)
摘要: 模板位置 E:\develop\MyEclipse Professional 2014\plugins模板文件 com.genuitec.eclipse.wizards_11.5.0.me201310291746.jar用压缩软件打开jar文件,在templates文件夹中找到servlet.jav... 阅读全文
posted @ 2014-04-13 22:06 一路向北中 阅读(204) 评论(0) 推荐(0)
摘要: 1,首先的下载servlet.jar2,把jar文件加入classpath路径3,javac...F:\>set classpath=E:\develop\classes\servlet-api-3.0.20090124.jar 阅读全文
posted @ 2014-04-12 22:15 一路向北中 阅读(176) 评论(0) 推荐(0)
摘要: 1,使用解压缩版本的tomcat.zip2,点击bin\startup.bat,cmd窗口一闪而过解决方法1,添加JAVA_HOME环境变量 C:\Program Files\Java\jdk1.7.0_45\ 后面没有分号2,点击bin\startup.bat 阅读全文
posted @ 2014-04-11 18:16 一路向北中 阅读(125) 评论(0) 推荐(0)
摘要: 1 @Test2 public void test() throws Exception{3 DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();4 DocumentBuilder db = fac.newDocumentBuilder();5 Document document = db.parse("src/1.xml");6 NodeList nl = document.getElementsByTagName("aaa");7 ... 阅读全文
posted @ 2014-04-09 15:57 一路向北中 阅读(121) 评论(0) 推荐(0)
摘要: 1 import org.junit.Test; 2 3 public class ArrReserve { 4 @Test 5 public void test() { 6 // String[] arr = {"1","2","3","4","5","6"}; 7 Integer[] arr = { 1, 2, 3 };//如果把Integer改成int,会编译失败,因为自定义泛型不能是基本数据类型?! 8 reserve(arr); 9 }10 11 public vo 阅读全文
posted @ 2014-04-08 19:56 一路向北中 阅读(157) 评论(0) 推荐(0)
摘要: 1 @Test 2 public void test(){ 3 Map myMap = new LinkedHashMap(); 4 myMap.put("s1", 1); 5 myMap.put("s2", 2); 6 myMap.put("s3", 3); 7 8 Set> entrySet = myMap.entrySet(); 9 for(Map.Entry e:entrySet){10 String key = e.getKey();11... 阅读全文
posted @ 2014-04-08 15:46 一路向北中 阅读(334) 评论(0) 推荐(0)
摘要: 略 阅读全文
posted @ 2014-04-08 13:22 一路向北中 阅读(190) 评论(0) 推荐(0)
摘要: 1 @Test2 public void testBean() throws ClassNotFoundException, Exception, IllegalAccessException{3 Class clazz = Class.forName("cn.linson.java.Person");4 Person bean = (Person) clazz.newInstance();5 String value = "xiaoqiang";6 BeanUtils.setProperty(bean, "name", ... 阅读全文
posted @ 2014-04-08 13:21 一路向北中 阅读(617) 评论(0) 推荐(0)
摘要: http://commons.apache.org/proper/commons-beanutils/download_beanutils.cgihttp://commons.apache.org/proper/commons-logging/download_logging.cgi 阅读全文
posted @ 2014-04-08 13:17 一路向北中 阅读(159) 评论(0) 推荐(0)
摘要: @Test public void testReflect() throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException, InstantiationException { Class clazz = Class.forName("cn.linson.java.Person"); Person p = (Person) clazz.newInstance(); Field[] fileds = claz... 阅读全文
posted @ 2014-04-08 13:05 一路向北中 阅读(174) 评论(0) 推荐(0)
摘要: 君子性非异也,善假于物也。 阅读全文
posted @ 2014-03-14 14:38 一路向北中 阅读(139) 评论(0) 推荐(0)
摘要: 1 class Demo4 2 { 3 public static void main(String[] args) 4 { 5 Res r = new Res(); 6 Input in = new Input(r); 7 Output out = new Output(r); 8 new Thread(in).start(); 9 new Thread(out).start();10 }11 }12 class Res13 {14 String name;15 ... 阅读全文
posted @ 2014-03-05 18:04 一路向北中 阅读(144) 评论(0) 推荐(0)
摘要: 1 class Demo3 2 { 3 public static void main(String[] args) 4 { 5 System.out.println("Hello World!"); 6 T1 t1 = new T1(); 7 T2 t2 = new T2(); 8 new Thread(t1).start(); 9 new Thread(t2).start();10 }11 }12 class MyLock13 {14 static Object obj1 ... 阅读全文
posted @ 2014-03-05 10:51 一路向北中 阅读(146) 评论(0) 推荐(0)
摘要: static void me(){ String s = "abc"; StringBuilder sb = new StringBuilder(s); sb.reverse(); System.out.println(sb.toString());} 阅读全文
posted @ 2014-03-04 20:04 一路向北中 阅读(147) 评论(0) 推荐(0)
摘要: 给定一个16进制的字符串,变成10进制数1 String s = "1af";2 //验证方法3 Integer.parseInt(s,16); 阅读全文
posted @ 2014-02-23 22:48 一路向北中 阅读(181) 评论(0) 推荐(0)
摘要: 1 file.getName().split("\\.").length以上代码可以正确取得一个文件名的数组,包括文件名和扩展名length = 2如果不加转义字符\\,则只能取到空的数组...length = 0 阅读全文
posted @ 2014-02-20 16:20 一路向北中 阅读(129) 评论(0) 推荐(0)
摘要: 1 public static void method6()2 {3 char x = 'X';4 int i = 0;5 System.out.println(true ? x : 0);//X6 System.out.println(false ? i : x);//887 } 阅读全文
posted @ 2014-02-14 10:10 一路向北中 阅读(158) 评论(0) 推荐(0)
摘要: 1 String s1 = "aa"; 2 String s2 = "aabb"; 3 String s3 = "aa"+"bb"; 4 5 String s4 = new String("aabb"); 6 String s5 = new String("aabb"); 7 8 String s6 = s1 + "bb"; 9 String s7 = s1 + s2;10 sop(s2==s3);//true11 sop(s2==s4);//false1 阅读全文
posted @ 2014-02-14 09:01 一路向北中 阅读(181) 评论(0) 推荐(0)
摘要: 1 package cn.sice; 2 3 import java.math.BigInteger; 4 5 public class BigMathDemo 6 { 7 8 public static void main(String[] args) 9 { 10 for (int i = 0; i = length2) 96 { 97 // 数组长度+1,避免最高位进位,超出数组位数 98 length = length1 + 1; 99 } else... 阅读全文
posted @ 2014-02-08 23:44 一路向北中 阅读(260) 评论(0) 推荐(0)
摘要: 1 package cn.sice; 2 3 public class SwtichDemo 4 { 5 6 public static void main(String[] args) 7 { 8 int x = 1; 9 byte b = 2;10 short s = 3;11 char c = 4;12 switch (c)13 {14 case 1:15 System.out.println("int = " + x);16 ... 阅读全文
posted @ 2014-02-08 21:18 一路向北中 阅读(301) 评论(0) 推荐(0)
摘要: 1 package cn.sice; 2 3 public class OutMultFor 4 { 5 6 public static void main(String[] args) 7 { 8 boolean flag = true; 9 hh: for (int i = 0; i < 10 && flag; i++)10 {11 ss: for (int j = 0; j < 10; j++)12 {13 System.out.print... 阅读全文
posted @ 2014-02-08 21:01 一路向北中 阅读(117) 评论(0) 推荐(0)
摘要: 1 package cn.sice; 2 3 public class CharTest 4 { 5 6 public static void main(String[] args) 7 { 8 sop((char) 65633);// a 9 sop((char) (65633 - 65536));// a10 }11 12 public static void sop(Object obj)13 {14 System.out.println(obj);15 }16 17 publi... 阅读全文
posted @ 2014-02-08 20:21 一路向北中 阅读(466) 评论(0) 推荐(0)
摘要: 1 public static void main(String[] args) 2 { 3 String s1 = "123"; 4 String s2 = new String("123"); 5 sop(s1==s2); 6 7 Integer i1 = 127; 8 Integer i2 = 127; 9 sop(i1==i2);10 11 Integer i3 = 128;12 Integer i4 = 1... 阅读全文
posted @ 2014-02-07 15:02 一路向北中 阅读(204) 评论(0) 推荐(0)
摘要: 1 package cn.sice; 2 3 import java.util.ArrayList; 4 import java.util.Date; 5 import java.util.concurrent.locks.Condition; 6 import java.util.concurrent.locks.Lock; 7 import java.util.concurrent.locks.ReentrantLock; 8 9 public class LockDemo 10 { 11 12 public static void main(String... 阅读全文
posted @ 2014-02-04 15:19 一路向北中 阅读(393) 评论(0) 推荐(0)
摘要: 1 package cn.sice; 2 3 public class SingleDemo 4 { 5 6 public static void main(String[] args) 7 { 8 Single s = Single.getInstance(); 9 }10 11 }12 13 class Single14 {15 private static Single sin = null;16 17 private Single()18 {19 20 }21 22 public static Sin... 阅读全文
posted @ 2014-02-03 20:09 一路向北中 阅读(116) 评论(0) 推荐(0)
摘要: 1 Ctrl+1 快速修复(最经典的快捷键,就不用多说了) 2 Ctrl+D: 删除当前行 3 Ctrl+Alt+↓ 复制当前行到下一行(复制增加) 4 Ctrl+Alt+↑ 复制当前行到上一行(复制增加) 5 Alt+↓ 当前行和下面一行交互位置(特别实用,可以省去先剪切,再粘贴了) 6 Alt+↑ 当前行和上面一行交互位置(同上) 7 Alt+← 前一个编辑的页面 8 Alt+→ 下一个编辑的页面(当然是针对上面那条来说了) 9 Alt+Enter 显示当前选择资源(工程,or 文件 or文件)的属性 10 Shift+Enter 在当前行的下一行插入空行(这时鼠标可... 阅读全文
posted @ 2014-02-03 20:00 一路向北中 阅读(189) 评论(0) 推荐(0)
摘要: 类的所有实例共享同一个static变量(火车卖票) 阅读全文
posted @ 2014-02-03 12:43 一路向北中 阅读(117) 评论(0) 推荐(0)
摘要: 我要更努力些,希望我再看这段文字的时候能够微笑面对! 阅读全文
posted @ 2014-02-03 00:42 一路向北中 阅读(100) 评论(0) 推荐(0)
摘要: 遇到一个PATH路径的问题,在PATH中添加了jar.exe的路径后,在小Q书桌中添加快捷方式的cmd,点击后输入jar,无法执行,但在sys32目录点击cmd却可以执行,不知道为什么...注:重启电脑后 小Q书桌中添加快捷方式的cmd就可以运行jar.exe了。 阅读全文
posted @ 2014-02-03 00:41 一路向北中 阅读(124) 评论(0) 推荐(0)
摘要: 在java源码中看到这个单词unascribed,标记在author的后面,ascribed的意思是归因于,那unascribed应该就是不归属于任何的意思吧,也就是java源码的作者不归属于任何人?! 阅读全文
posted @ 2014-02-03 00:38 一路向北中 阅读(4370) 评论(0) 推荐(0)
摘要: 1 public class Day052 2 { 3 4 public static void main(String[] args) 5 { 6 Zi z = new Zi(); 7 z.print(); 8 } 9 10 }11 12 class Fu13 {14 private int f1 = setF1("Fu 给成员变量赋值 ", 1);15 private static int f2 = setF2("Fu 给静态变量赋值 ", 2);16 17 int setF1(String s, int ... 阅读全文
posted @ 2014-01-13 18:12 一路向北中 阅读(193) 评论(0) 推荐(0)
摘要: 1 public class Day052 2 { 3 4 public static void main(String[] args) 5 { 6 Zi z = new Zi(); 7 z.print(); 8 } 9 10 }11 12... 阅读全文
posted @ 2014-01-13 15:19 一路向北中 阅读(167) 评论(0) 推荐(0)
摘要: 1 byte = 1字节 = 8bit 可表达2的8次方个数字(256--> -128 --- 127)1 short = 2字节 = 16bit 可表达2的16次方个数字(65536)1 int = 4字节 = 32bit 可表达2的32次方(4294967296) 1 long = 8字节 = ... 阅读全文
posted @ 2014-01-12 20:24 一路向北中 阅读(711) 评论(0) 推荐(0)
摘要: 父类引用指向其子类对象 阅读全文
posted @ 2014-01-12 19:45 一路向北中 阅读(99) 评论(0) 推荐(0)