共 20篇 前 3 页:    每页10篇 下一页  

java相关

[url] http://www.qall.com/ [/url]

全呼通是网站三维互动情景展示系统,可三维立体展示与互动,播放宣传短片、即时视频、多人洽谈、现场情景化展示销售、主动营销、赢得客户,网站访客只需点击网页中的对话图标,无需安装或下载任何插件,就能直接和网站客服人员进行即时文字语音视频情景化交流。

除了增值服务,而且是免费的哦!

air_tuyh   2007-05-09 10:23:33 阅读:71  评论:0  引用:0

方法索引

clone()
创建与该对象的类相同的新对象。
equals(Object)
比较两对象是否相等。
finalize()
当垃圾回收器确定不存在对该对象的更多引用时,对象的垃圾回收器调用该方法。
getClass()
返回一个对象的运行时间类。
hashCode()
返回该对象的散列码值。
notify()
激活等待在该对象的监视器上的一个线程。
notifyAll()
激活等待在该对象的监视器上的全部线程。
toString()
返回该对象的字符串表示。
wait()
等待这个对象另一个更改线程的通知。
wait(long)
等待这个对象另一个更改线程的通知。
wait(long, int)
等待这个对象另一个更改线程的通知。
air_tuyh   2007-04-28 14:11:34 阅读:46  评论:0  引用:0
"可变"和"不可变",和是不是final没有关系

举个例子:

String str1 = "hello";
String str2 = "world";
String str1 = str1 + str2;//这里所做的内部操作,其实不是把str1的内容改变为原str1+str2的内容这么简单, 而把创建一个新的String, 内容为str1 + str2的内容,然后再把str1这个引用重新指向新创建的String, 这就是上面说的String不可变.

而如果是StringBuffer的话,则直接更改str1的内容,而不是先创建一个新的StringBuffer


使用 StringBuffer 主要就是在性能上的考虑。

String 是一种非常常用的数据类型,但由于 String 是不可变对象,在进行 String 的相关操作的时候会产生许多临时的 String 对象。

而 StringBuffer 在操作上是在一个缓冲中进行的,性能当然优越得多。

不过,一般做为简单的字符串传递和其它操作,只不要改变字符串内容的操作,用 String 效率会高一些。

air_tuyh   2007-04-28 13:29:33 阅读:38  评论:0  引用:0
〖摘要:〗

摘要:
aList.Add("a");
aList.Insert(0,"aa");
aList.InsertRange(2,list2);
aList.Remove("a");
aList.RemoveAt(0);
aList.RemoveRange(1,3);
aList.Sort();//排序
aList.Reverse();//反转
intnIndex=aList.IndexOf(“a”);//1
nIndex=aList.IndexOf(“p”);//没找到,-1
a)publicvirtualintIndexOf(object);
b)publicvirtualintIndexOf(object,int);
c)publicvirtualintIndexOf(object,int,int);
d)publicvirtualintLastIndexOf(object);
e)publicvirtualintLastIndexOf(object,int);
f)publicvirtualintLastIndexOf(object,int,int);
intnIndex=aList.LastIndexOf("a");//值为2而不是0
aList.TrimToSize();//Count=Capacity=5;


System.Collections.ArrayList类是一个特殊的数组。通过添加和删除元素,就可以动态改变数组的长度。

一.优点

1。支持自动改变大小的功能
2。可以灵活的插入元素
3。可以灵活的删除元素

二.局限性

跟一般的数组比起来,速度上差些

三.添加元素

1.publicvirtualintAdd(objectvalue);

将对象添加到ArrayList的结尾处

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
内容为abcde

2.publicvirtualvoidInsert(intindex,objectvalue);

将元素插入ArrayList的指定索引处

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.Insert(0,"aa");

结果为aaabcde

3.publicvirtualvoidInsertRange(intindex,ICollectionc);

将集合中的某个元素插入ArrayList的指定索引处

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
ArrayListlist2=newArrayList();
list2.Add("tt");
list2.Add("ttt");
aList.InsertRange(2,list2);

结果为abtttttcde

四.删除

a)publicvirtualvoidRemove(objectobj);

从ArrayList中移除特定对象的第一个匹配项,注意是第一个

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.Remove("a");

结果为bcde

2.publicvirtualvoidRemoveAt(intindex);

移除ArrayList的指定索引处的元素

aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.RemoveAt(0);

结果为bcde

3.publicvirtualvoidRemoveRange(intindex,intcount);

从ArrayList中移除一定范围的元素。Index表示索引,count表示从索引处开始的数目

aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.RemoveRange(1,3);

结果为ae

4.publicvirtualvoidClear();

从ArrayList中移除所有元素。

五.排序

a)publicvirtualvoidSort();

对ArrayList或它的一部分中的元素进行排序。

ArrayListaList=newArrayList();
aList.Add("e");
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
DropDownList1.DataSource=aList;//DropDownListDropDownList1;
DropDownList1.DataBind();

结果为eabcd

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.Sort();//排序
DropDownList1.DataSource=aList;//DropDownListDropDownList1;
DropDownList1.DataBind();

结果为abcde

b)publicvirtualvoidReverse();

将ArrayList或它的一部分中元素的顺序反转。

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.Reverse();//反转
DropDownList1.DataSource=aList;//DropDownListDropDownList1;
DropDownList1.DataBind();
结果为edcba

六.查找

a)publicvirtualintIndexOf(object);
b)publicvirtualintIndexOf(object,int);
c)publicvirtualintIndexOf(object,int,int);

返回ArrayList或它的一部分中某个值的第一个匹配项的从零开始的索引。没找到返回-1。

ArrayListaList=newArrayList();
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
intnIndex=aList.IndexOf(“a”);//1
nIndex=aList.IndexOf(“p”);//没找到,-1
d)publicvirtualintLastIndexOf(object);
e)publicvirtualintLastIndexOf(object,int);
f)publicvirtualintLastIndexOf(object,int,int);

返回ArrayList或
继续阅读其余的  1325 字

air_tuyh   2007-04-28 09:45:17 阅读:56  评论:1  引用:0
  凡事顺其自然,顺应规律就好,不可过于强求.
air_tuyh   2007-04-02 09:20:43 阅读:43  评论:0  引用:0
import java.util.*;
/**
* 福彩
* @author tuyh
*
*/
public class Lottery {
private  int[] LotteryNumber;// 结果数组
/**
* 主方法
* @param args
*/
public static void main(String[] args) {
for(int i =0;i<7;i++){
new Lottery().OutputLotteryNumber();
}
}
/**
* 实现彩球选取方法
*
*/
public void OutputLotteryNumber(){
Random random = new Random();
LotteryNumber=new int[7];

int[] number=new int[33];
for(int i=1;i<number.length;i++){
number=i;
}
//获取篮球 begin
int temp;
for( temp=0;temp<LotteryNumber.length-1;temp++){
LotteryNumber[temp]=number[random.nextInt(32)+1 ];
while(contains(LotteryNumber[temp],temp)){//判断是否是已选球,是则重新选择
LotteryNumber[temp]=number[random.nextInt(32)+1 ];
}
}
//获取篮球 end
LotteryNumber[6]=number[random.nextInt(32)+1 ];//获取红球
for (int i = 0; i < LotteryNumber.length; i++) {//输出结果
if (i == 0) {
System.out.print("蓝球:");
}
System.out.print(""+LotteryNumber+" ");
if(i==5){
System.out.print("红球");
}
}
}
/**
* 判断是否是已选球
* @param j
* @return
*/
public  boolean contains(int j, int i ){
for(int temp1=0;temp1<=LotteryNumber.length-1;temp1++){
if (j==LotteryNumber[temp1]&&temp1!=i){
return true;
}
}
return false;
}
}
air_tuyh   2007-03-23 09:50:07 阅读:47  评论:0  引用:0
\admin\orcl\pfile\init.ora文件(名字类似于这样),在这个文件中找到open_cursors

在sqlplus中查看 open_cursors的数值:



在sqlplus中执行

SELECT v.name, v.value value FROM V$PARAMETER v WHERE name = 'open_cursors';

看看value是多少

使用下面的命令可以修改它的大小:

  在   oracle9i   中应该可以直接进行修改:  
  alter   system   set   open_cursors=30000;  
  如果可以就直接生效了;如果不行可以使用下面的语句:  
  alter   system   set   open_cursors=30000 scope=spfile;  
  然后重启数据库生效

air_tuyh   2007-03-21 14:06:37 阅读:400  评论:0  引用:0
1. 原有数据库备份

exp epro_jyj/1234 file=d:\share\epro_jyj_backup20061220.dmp
exp epro_ocs/1234 file=d:\share\epro_ocs_backup20061220.dmp

2. 卸载Oracle
卸载oracle,重新安装卸载,如何删除原来的数据库sid
  1、   开始->设置->控制面板->管理工具->服务,停止所有Oracle服务。  
  2、   开始->程序->Oracle   -   OraHome81->Oracle Installation Products->Universal Installer,卸装所有Oracle产品,但Universal Installer本身不能被删除
  5、   运行regedit,选择HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE,按del键删除这个入口。    
  6、   运行regedit,选择HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services,滚动   这个列表,删除所有Oracle入口。    
  7、   运行refedit,   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application,   删除所有Oracle入口。    
  8、   开始->设置->控制面板->系统->高级->环境变量   删除环境变量CLASSPATH和PATH中有关Oracle的设定    
  9、   从桌面上、STARTUP(启动)组、程序菜单中,删除所有有关Oracle的组和图标    
  10、   删除\Program   Files\Oracle目录    
  11、   重新启动计算机,重起后才能完全删除Oracle所在目录  
  12、   删除与Oracle有关的文件,选择Oracle所在的缺省目录C:\Oracle,删除这个入   口目录及所有子目录,并从Windows   2000目录(一般为C:\WINNT)下删除以下文   件ORACLE.INI、oradim73.INI、oradim80.INI、oraodbc.ini等等。  
  13、   WIN.INI文件中若有[ORACLE]的标记段,删除该段    
  14、   如有必要,删除所有Oracle相关的ODBC的DSN    
  15、   到事件查看器中,删除Oracle相关的日志   说明:   如果有个别DLL文件无法删除的情况,则不用理会,重新启动,开始新的安装,   安装时,选择一个新的目录,则,安装完毕并重新启动后,老的目录及文件就可以删除掉了。

3. 安装Oracle

4. 导入原数据

create tablespace epro_jyj datafile 'D:\oracle\oradata\orcl9\epro_jyj.dbf' size 500M;
create user epro_jyj identified by "1234" default tablespace epro_jyj;
grant dba to epro_jyj;

create tablespace epro_ocs datafile 'D:\oracle\oradata\orcl9\epro_ocs.dbf' size 100M;
create user epro_ocs identified by "1234" default tablespace epro_ocs;
grant dba to epro_ocs;

imp epro_jyj/1234 fromuser=epro_jyj touser=epro_jyj file=d:\share\epro_jyj_backup20061220.dmp
imp epro_ocs/1234 fromuser=epro_ocs touser=epro_ocs file=d:\share\epro_ocs_backup20061220.dmp
air_tuyh   2007-01-02 14:12:33 阅读:215  评论:0  引用:0
ant安装

1 选择ant的正确版本

选择二进制的发布创建(通过了测试)可以满足大多数用户的要求。
Use Ant for creating a build/deployment process ――Binary release build
二进制下载地址:http://ant.apache.org/bindownload.cgi

如果选择了ant的其他版本就要进行ant创建,如何操作参看相关资料:
http://ant.apache.org/manual/install.html


2安装ant

设置环境变量:JAVA_HOME――被设置为JDK的安装路径
ANT_HOME ――被设置为ANT的安装路径
PATH ――应该包含$ANT_HOME/bin

设置可选任务两个构件:
1 实际工具本身
2 任务代码
以junit 为例,junit.jar 文件必须添加到系统的CLASSPATH或者Ant安装目录的lib目录下,任务类必须包含
在optional.jar文件中,optional.jar文件必须被添加到系统的系统的CLASSPATH或者Ant安装目录的lib目录下,
(如果采用ant创建,方法则不同)


3调试安装
可以通过下述命令在没有buildfile的情况下测试Ant的安装过程
ant -version
如果ant运行正常,这个命令会打印出ant的版本号。



附:配置文件中包含的,能够改变ant环境的变量。
例如:JAVACMD可以设置为JAVA虚拟机的全路径名。如果没被指定,默认值是JAVA_HOME/bin/java(.exe),
这对大多数用户是适用的。ANT_OPTS中设定用户可以通过执行java -help命令来查看这个参数的
详细信息。可以将包含在单引号中的多个参数传递给JVM。例如:ANT_OPTS='-showversion -mx500m'
air_tuyh   2005-05-28 21:21:24 阅读:5991  评论:0  引用:0
Junit 进行单元测试


Junit是开放源码技术,相关资料可从http://www.junit.org找到。
开始使用Junit前,只要下载jar,把它放入你的classpath中就可以。


以下只是简单的通过事例来阐述Junit如何使用,实例本身没有任何价值。


创建单元测试步骤:
1:创建一个扩展到junit.framework.TestCase的类(来自junit.jar).
2: 在这个类中创建一个公用void方法,在这里它的名称以"test"开始。方法其他名称取决于你自己
例如:testUpdateAccount().
3: 在这个方法中调用assertEquals()方法,调用被测试的代码并检查实际的返回值与所期望值的区别。

被测试类:JunitTest.java

public class JunitTest {
private String x;
public void prt(String x){
System.out.print(x);
this.x = x;
}

public String getString(){
return x;
}

}


测试类:TestJunitTest.java

import junit.framework.TestCase;
public class TestJunitTest extends TestCase {
// extends TestCase
public void testPrintSimpleLine() {
// method name starts with 'test'
JunitTest prt = new JunitTest();
prt.prt(
"Bill");

// verify actual results equal those that are expected
assertEquals(
"Bill",prt.getString());
}
}



运行多个测试:


import junit.framework.TestCase;
public class TestJunitTest extends TestCase {
// extends TestCase
public void testPrintMultipleLines() {
// method name starts with 'test'
JunitTest prt = new JunitTest();
prt.prt(
"Bill");

// verify actual results equal those that are expected
assertEquals(
"Bill",prt.getString());
prt.prt(
"hello");
assertEquals(
"hello",prt.getString());
}
}

air_tuyh   2005-05-17 19:18:57 阅读:2296  评论:0  引用:0
Copyright@2006 powered by YuLog