2008-03-24

Java经典程序

关键字: 极品
1、写出程序运行结果 public class Test{    static boolean foo(char c){     System.out.println(c);     return true;    }    public static void main(String[] args){      int i=0;      for(foo('A');foo('B')&&a ...
2008-03-08

Java对象序列化

关键字: 基础知识
java对象序列化2008-01-21 18:11所谓对象序列化就是将对象的状态转换成字节流,以后可以通过这些值再生成相同状态的对象。这个过程也可以通过网络实现,可以先在Windows机器上创建一个对象,对其序列化,然后通过网络发给一台Unix机器,然后在那里准确无误地重新"装配"。像RMI、Socket、JMS、EJB它们中的一种,彼此为什么能够传递Java对象,当然都是对象序列化机制的功劳。   java对象序列化机制一般来讲有两种用途:        1.Java的JavaBeans: Bean的状态信息通 ...
2008-03-07

取掉四则混合运算中的注释,并输出式子

关键字: string、stringbuffer、数组、正则表达式
public class Test5 { public static void main(String[] args){ String str="(1.9/*3C6*/+(20+41)/*AA*//(25*11/*BB*/)-3)*2+3/2/*00*/"; //条件:"/*[[0-9][A-Z][0-9]][[A-Z][A-Z]][[0-9][0-9]]*/"; String ss="(/\\p{Punct}[A-Z][A-Z]\\p{Punct}/)|(/\\p{Punct}[0-9][A-Z][0-9]\\p{Punct}/)|(/\\p{Punct}[0-9][0-9]\ ...
2008-02-28

递归算法

关键字: 文件目录
用递归实现文件目录列表: File dir = new File("d:\\java\project"); public void directory(File dir){   String[] fileList = dir.list();   String  dirPath = new dir.getAbsolutePath();   for(int  i=0;i<file.length;i++){     File file = new File(dirPath+"\\"+fileList[i]); ...
2008-02-28

文件输入输出I/O

关键字: 文件i/o
File主要用于在磁盘上读写文件 1、在程序中,用File和JFileChoose让用户定义或者指定一个文件 2、在文件中,用FileOutputStream和FileInputStream读写字节 3、在文件中,用DataOutputStream和DataInputStream读写原始数据类型值 4、在文件中,用PrintWriter和BufferedReader读写对象 5、在文件中,用ObjectOutputStream和ObjectInputStream读写对象 文件输入输出中常见对象的方法如下: File对象的几个常用方法: ①exists():文件是否存在 ②isFile():判断 ...
2008-02-28

搜索和排序

关键字: 搜索和排序
搜索分:线性搜索(普通的搜索)和二分搜索; 排序分:选择排序、冒泡排序、堆排序。 二分搜索: public int binarySearch(int[] number,int searchValue){ int low=0, high=number.length-1, mid=(low+high)/2; while(low<=high && number[mid] != searchValue){ System.out.println(mid); if(number[mid]<searchValue){ low=mid+1; }else{ ...
shang
搜索本博客
我的相册
79a9382f-8722-42cd-a96d-fd48c13927c1-thumb
IMG_4731
共 1 张
最近加入圈子
存档
最新评论