1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. 常見java面試題

        時間:2024-08-12 03:47:35 面試筆試 我要投稿

        常見java面試題

               用JAVA實現一種排序,JAVA類實現序列化的方法(二種)? 如在COLLECTION框架中,實現比較要實現什么樣的接口?
               答:用插入法進行排序代碼如下
        package test;
        import java.util.*;
        class  InsertSort
        {
        ArrayList al;
        public InsertSort(int num,int mod)
        {
        al = new ArrayList(num);
        Random rand = new Random();
        System.out.println(”The ArrayList Sort Before:”);
        for (int i=0;i<num ;i++ )
        {
        al.add(new Integer(Math.abs(rand.nextInt()) % mod + 1));
        System.out.println(”al["+i+"]=”+al.get(i));
        }
        }
        public void SortIt()
        {
        Integer tempInt;
        int MaxSize=1;
        for(int i=1;i<al.size();i++)
        {
        tempInt = (Integer)al.remove(i);
        if(tempInt.intValue()>=((Integer)al.get(MaxSize-1)).intValue())
        {
        al.add(MaxSize,tempInt);
        MaxSize++;
        System.out.println(al.toString());
        } else {
        for (int j=0;j<MaxSize ;j++ )
        {
        if

        常見java面試題

        (((Integer)al.get(j)).intValue()>=tempInt.intValue())
        {
        al.add(j,tempInt);
        MaxSize++;
        System.out.println(al.toString());
        break;
        }
        }
        }
        }
        System.out.println(”The ArrayList Sort After:”);
        for(int i=0;i<al.size();i++)
        {
        System.out.println(”al["+i+"]=”+al.get(i));
        }
        }
        public static void main(String[] args)
        {
        InsertSort is = new InsertSort(10,100);
        is.SortIt();
        }
        }

        【常見java面試題】相關文章:

        java程序員常見面試題10-18

        Java經典面試題07-17

        關于JAVA的面試題09-13

        中興java面試題08-27

        高級java面試題07-02

        華為Java面試題08-14

        java面試題201408-11

        java面試題及答案10-27

        常見通用的面試題10-14

        常見的EQ面試題08-20

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>