文章分类 -  java学习

java 方法重载的时候,同一个类,父子类,调用哪个方法的问题
摘要:1、在同一个类中,按照参数严格匹配的原则,示例如下:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package com.java.test;public class Test extends Parent { public static void main(String[] args) { System.out.println("haha"); Test t= new Test(); t.t2(3); } publ 阅读全文
posted @ 2010-08-25 09:37 snowdrop 阅读(6186) 评论(0) 推荐(0)
参数调用不会改变参数值
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package com.java.test;publicclass T1 {publicstaticvoid main(String args[]){String s1="123";int t2=333;T1 t=new T1();t.t1(s1);System.out.println(s1);t.t3(t2);System.out.println(String.valu 阅读全文
posted @ 2010-08-23 09:54 snowdrop 阅读(200) 评论(0) 推荐(0)
栈内存和堆内存简单实例
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package com.java.test;publicclass T1 {publicstaticvoid main(String args[]){String s1="123";String s2="123";System.out.println(s1==s2);String s3=new String("abc");Strin 阅读全文
posted @ 2010-08-23 09:37 snowdrop 阅读(114) 评论(0) 推荐(0)
ubuntu下设置软件指向哪个目录
摘要:问题:比如运行which fastboot,会出现一个路径A,如果你在另一个地方B也有这个fastboot,并且你想默认指向这个地方B,怎么办不是 通过建立符号链接而是通过环境变量的设置在普通用户权限下,运行修改环境变量,vim ~./bashrc把这个地方的路径加进去。 export PATH=$PATH:/home/srx/master/out/host/linux-x86/bin保存,退出。重启电脑,否则不能生效。即可。 阅读全文
posted @ 2010-08-20 16:07 snowdrop 阅读(240) 评论(0) 推荐(0)
java static使用,区分
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package com.java.test;public class T { //类变量,静态变量public static String s="srx";public String s1="zf";public static void main(String args[]){ System.out.println("s=="+s) 阅读全文
posted @ 2010-08-19 09:38 snowdrop 阅读(392) 评论(0) 推荐(0)
java方法重写的时候,一个调用父类还是子类方法的问题
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package com.java.test;public class T extends Parent { public void Method1(int a, int c, String b) { System.out.println("this is t.t1"); } public static void main(String args[]) { T t = ne 阅读全文
posted @ 2010-08-18 09:32 snowdrop 阅读(14302) 评论(1) 推荐(0)
java 接口实现简单并能说明问题的例子
摘要:此代码一共包括4个类,在一个包下面:例子1:分别是CAR.java,BigCar.java,TestCar.java,CarInterface.java,从别人网页上学习,自己心得。CAR.java:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package com.su.callback;publicinterface CAR {void start();void stop();}声明一个接口,不实现方法,只声明方法。抽口不能实例化。B 阅读全文
posted @ 2010-08-12 10:37 snowdrop 阅读(30795) 评论(0) 推荐(1)
java split简单应用
摘要:1、见空格就隔开Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->publicclass SplitTest {publicstatic String[] aa=new String[20];public SplitTest(){String s ="haha heihei ss dd ff";//aa=s.split("");//中间一定要有空格,不然就会一个字母一个字目隔开了aa=s.split(&q 阅读全文
posted @ 2010-08-04 17:20 snowdrop 阅读(323) 评论(0) 推荐(0)
java Thread两种简单用法总结
摘要:方法一: 用继承Thread实现实例:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package threadtest13;//多线程的写法2,用两种情况变换,//情况1:新建一个对象,两个线程共享一个对象。另外是新建两个对象,两个线程用两个对象//情况2:int i=0;拿到run()外面与在run()里面两种情况。//上面4种情况可以排列组合试一下publicclass Thread13 {publicstaticvoid mai 阅读全文
posted @ 2010-08-04 11:08 snowdrop 阅读(62901) 评论(0) 推荐(1)
解决服务器端java代码,重新编译后,不能更新问题
摘要:解决服务器端java代码,重新编译后,不能更新问题,点右下角的tomcat,点stop,再start,这样不用改类名,web.xml中也不需要重新配置类名,activity中也不需要更改类名,servlet服务器端也可以识别新生成的同名类。 阅读全文
posted @ 2010-04-30 12:42 snowdrop 阅读(583) 评论(0) 推荐(0)