DOC

JAVA

By Patrick Stewart,2014-05-17 14:51
14 views 0
JAVA

    1public static void main(String[] args) {

     StringBuffer str=new StringBuffer("helloworld");

     str.reverse();

     System.out.println(str);

     }

    2import java.util.Date;

    import java.text.SimpleDateFormat;

    public class Main {

     public static void main(String[] args) {

    { Date nowTime=new Date();

     System.out.println(nowTime);

     new SimpleDateFormat matter=new("'time':E HH mmss");

     System.out.println(matter.format(nowTime));

     }

    }

    }

3Import java.util.*;

     class Test

     {

     public static void main(String args[])

     {

     Calendar c=Calendar.getInstance();

     c.set(1990.8.22);

     long time 1=c.getTimeInMillis ();

     c.set(2010.2.24);

     long time 2=c.getTimeInMillis();

     long 相隔天数 =(time 1-time 2)/(1000*60*60*24);

     System.out.println("2010224 1990822日相隔"+相隔天数+"");

     }

     }

    4public static void main(String[] args) {

     {BigInteger sum=new BigInteger(0),

     xiang=new BigInteger(1);

     ONE=new BigInteger(1),

     i=ONE,

     m= new BigInteger(30);

     while (i.compareTo(m)<=0)

     { sum=sum.add(xiang);

     i=i.add(ONE);

     Xiang=xiang.multiply(i);

     i=i.add(ONE);

     Xiang=xiang.multiply(i);

     }

System.out.println(sum);

}

Report this document

For any questions or suggestions please email
cust-service@docsford.com