亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? module5.lst

?? Mcgraw-Hill - Java 2 - A Beginner S Guide, 2Nd Ed - 2003 -prog.
?? LST
?? 第 1 頁 / 共 2 頁
字號:
listing 1
// Demonstrate a one-dimensional array. 
class ArrayDemo {  
  public static void main(String args[]) {  
    int sample[] = new int[10]; 
    int i;  
  
    for(i = 0; i < 10; i = i+1)  
      sample[i] = i; 
 
    for(i = 0; i < 10; i = i+1)  
      System.out.println("This is sample[" + i + "]: " + 
                          sample[i]);  
  }  
}

listing 2
// Find the minimum and maximum values in an array. 
class MinMax {  
  public static void main(String args[]) {  
    int nums[] = new int[10]; 
    int min, max; 
 
    nums[0] = 99; 
    nums[1] = -10; 
    nums[2] = 100123; 
    nums[3] = 18; 
    nums[4] = -978; 
    nums[5] = 5623; 
    nums[6] = 463; 
    nums[7] = -9; 
    nums[8] = 287; 
    nums[9] = 49; 
 
    min = max = nums[0]; 
    for(int i=1; i < 10; i++) { 
      if(nums[i] < min) min = nums[i]; 
      if(nums[i] > max) max = nums[i]; 
    } 
    System.out.println("min and max: " + min + " " + max); 
  }  
}

listing 3
// Use array initializers. 
class MinMax2 {  
  public static void main(String args[]) {  
    int nums[] = { 99, -10, 100123, 18, -978, 
                   5623, 463, -9, 287, 49 }; 
    int min, max; 
 
    min = max = nums[0]; 
    for(int i=1; i < 10; i++) { 
      if(nums[i] < min) min = nums[i]; 
      if(nums[i] > max) max = nums[i]; 
    } 
    System.out.println("Min and max: " + min + " " + max); 
  }  
}

listing 4
// Demonstrate an array overrun. 
class ArrayErr {  
  public static void main(String args[]) {  
    int sample[] = new int[10]; 
    int i;  
  
    // generate an array overrun 
    for(i = 0; i < 100; i = i+1)  
      sample[i] = i; 
  }  
}

listing 5
/* 
   Project 5-1 
   Demonstrate the Bubble sort. 
*/ 
 
class Bubble {  
  public static void main(String args[]) {  
    int nums[] = { 99, -10, 100123, 18, -978, 
                   5623, 463, -9, 287, 49 }; 
    int a, b, t;  
    int size;  
  
    size = 10; // number of elements to sort  
  
    // display original array  
    System.out.print("Original array is:"); 
    for(int i=0; i < size; i++) 
      System.out.print(" " + nums[i]);  
    System.out.println();  
  
    // This is the bubble sort.  
    for(a=1; a < size; a++)  
      for(b=size-1; b >= a; b--) {  
        if(nums[b-1] > nums[b]) { // if out of order  
          // exchange elements   
          t = nums[b-1];  
          nums[b-1] = nums[b];  
          nums[b] = t;  
        }  
      }  
  
    // display sorted array  
    System.out.print("Sorted array is:");  
    for(int i=0; i < size; i++) 
      System.out.print(" " + nums[i]);  
    System.out.println(); 
  } 
}

listing 6
// Demonstrate a two-dimensional array.  
class TwoD {  
  public static void main(String args[]) {  
    int t, i; 
    int table[][] = new int[3][4];  
  
    for(t=0; t < 3; ++t) {  
      for(i=0; i < 4; ++i) {  
        table[t][i] = (t*4)+i+1;  
        System.out.print(table[t][i] + " ");  
      }  
      System.out.println(); 
    }  
  } 
}

listing 7
// Manually allocate differing size second dimensions.  
class Ragged {  
  public static void main(String args[]) {  
    int riders[][] = new int[7][];  
    riders[0] = new int[10];  
    riders[1] = new int[10];  
    riders[2] = new int[10];  
    riders[3] = new int[10];  
    riders[4] = new int[10];  
    riders[5] = new int[2];  
    riders[6] = new int[2];  
  
    int i, j; 
 
    // fabricate some fake data    
    for(i=0; i < 5; i++)   
      for(j=0; j < 10; j++)  
        riders[i][j] = i + j + 10;  
    for(i=5; i < 7; i++)   
      for(j=0; j < 2; j++)  
        riders[i][j] = i + j + 10;  
 
    System.out.println("Riders per trip during the week:"); 
    for(i=0; i < 5; i++) {  
      for(j=0; j < 10; j++)  
        System.out.print(riders[i][j] + " ");  
      System.out.println();  
    } 
    System.out.println(); 
 
    System.out.println("Riders per trip on the weekend:"); 
    for(i=5; i < 7; i++) {  
      for(j=0; j < 2; j++)  
        System.out.print(riders[i][j] + " ");   
      System.out.println();  
    }  
  }  
}

listing 8
// Initialize a two-dimensional array. 
class Squares {  
  public static void main(String args[]) {  
    int sqrs[][] = { 
      { 1, 1 }, 
      { 2, 4 }, 
      { 3, 9 }, 
      { 4, 16 }, 
      { 5, 25 }, 
      { 6, 36 }, 
      { 7, 49 }, 
      { 8, 64 }, 
      { 9, 81 }, 
      { 10, 100 } 
    }; 
    int i, j; 
 
    for(i=0; i < 10; i++) {  
      for(j=0; j < 2; j++)  
        System.out.print(sqrs[i][j] + " ");   
      System.out.println();  
    }  
  }  
}

listing 9
// Assigning array reference variables. 
class AssignARef {  
  public static void main(String args[]) {  
    int i; 
 
    int nums1[] = new int[10]; 
    int nums2[] = new int[10]; 
 
    for(i=0; i < 10; i++) 
      nums1[i] = i; 
 
    for(i=0; i < 10; i++) 
      nums2[i] = -i; 
 
    System.out.print("Here is nums1: "); 
    for(i=0; i < 10; i++) 
      System.out.print(nums1[i] + " ");   
    System.out.println(); 
 
    System.out.print("Here is nums2: "); 
    for(i=0; i < 10; i++) 
      System.out.print(nums2[i] + " ");   
    System.out.println(); 
 
    nums2 = nums1; // now nums2 refers to nums1 
 
    System.out.print("Here is nums2 after assignment: "); 
    for(i=0; i < 10; i++) 
      System.out.print(nums2[i] + " ");   
    System.out.println(); 
 
   // now operate on nums1 array through nums2 
   nums2[3] = 99; 
 
    System.out.print("Here is nums1 after change through nums2: "); 
    for(i=0; i < 10; i++) 
      System.out.print(nums1[i] + " ");   
    System.out.println(); 
  }  
}

listing 10
// Use the length array member.  
class LengthDemo {  
  public static void main(String args[]) {  
    int list[] = new int[10];  
    int nums[] = { 1, 2, 3 };  
    int table[][] = { // a variable-length table  
      {1, 2, 3},  
      {4, 5},  
      {6, 7, 8, 9}  
    };  
  
    System.out.println("length of list is " + list.length);  
    System.out.println("length of nums is " + nums.length);  
    System.out.println("length of table is " + table.length);  
    System.out.println("length of table[0] is " + table[0].length);  
    System.out.println("length of table[1] is " + table[1].length);  
    System.out.println("length of table[2] is " + table[2].length);  
    System.out.println(); 
  
    // use length to initialize list  
    for(int i=0; i < list.length; i++)  
      list[i] = i * i;  
  
    System.out.print("Here is list: "); 
    // now use length to display list  
    for(int i=0; i < list.length; i++)  
      System.out.print(list[i] + " ");  
    System.out.println(); 
  }  
}

listing 11
// Use length variable to help copy an array. 
class ACopy {  
  public static void main(String args[]) {  
    int i; 
    int nums1[] = new int[10]; 
    int nums2[] = new int[10]; 
 
    for(i=0; i < nums1.length; i++) 
      nums1[i] = i; 
 
    // copy nums1 to nums2 
    if(nums2.length >= nums1.length)  
      for(i = 0; i < nums2.length; i++) 
        nums2[i] = nums1[i]; 
 
    for(i=0; i < nums2.length; i++) 
      System.out.print(nums2[i] + " ");   
  } 
}

listing 12
/* 
   Project 5-2 
 
   A queue class for characters. 
*/ 
 
class Queue { 
  char q[]; // this array holds the queue 
  int putloc, getloc; // the put and get indices 
 
  Queue(int size) { 
    q = new char[size+1]; // allocate memory for queue 
    putloc = getloc = 0; 
  } 
 
  // put a characer into the queue 
  void put(char ch) { 
    if(putloc==q.length-1) { 
      System.out.println(" -- Queue is full."); 
      return; 
    } 
     
    putloc++; 
    q[putloc] = ch; 
  } 
 
  // get a character from the queue 
  char get() { 
    if(getloc == putloc) { 
      System.out.println(" -- Queue is empty."); 
      return (char) 0;  
    } 
   
    getloc++; 
    return q[getloc]; 
  } 
} 
 
// Demonstrate the Queue class. 
class QDemo { 
  public static void main(String args[]) { 
    Queue bigQ = new Queue(100); 
    Queue smallQ = new Queue(4); 
    char ch; 
    int i; 
 
    System.out.println("Using bigQ to store the alphabet."); 
    // put some numbers into bigQ 
    for(i=0; i < 26; i++) 
      bigQ.put((char) ('A' + i)); 
 
    // retrieve and display elements from bigQ 
    System.out.print("Contents of bigQ: "); 
    for(i=0; i < 26; i++) {  
      ch = bigQ.get(); 
      if(ch != (char) 0) System.out.print(ch); 
    } 
 
    System.out.println("\n"); 
 
 
    System.out.println("Using smallQ to generate erros."); 
    // Now, use smallQ to generate some errors 
    for(i=0; i < 5; i++) { 
      System.out.print("Attempting to store " + 
                       (char) ('Z' - i)); 
 
      smallQ.put((char) ('Z' - i)); 
 
      System.out.println(); 
    } 
    System.out.println(); 
 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区公司| 欧美激情资源网| 欧美日本视频在线| 欧美在线高清视频| 色网综合在线观看| 色视频成人在线观看免| 一本久道久久综合中文字幕| 色综合一个色综合亚洲| 99精品国产视频| 色悠久久久久综合欧美99| 色综合久久天天综合网| 日本二三区不卡| 亚洲制服丝袜在线| 亚洲成av人片观看| 蜜桃91丨九色丨蝌蚪91桃色| 激情文学综合插| 国产黄人亚洲片| 99re视频精品| 欧美色偷偷大香| 91精品国产综合久久福利软件 | 国产精品69毛片高清亚洲| 国产精品自拍网站| 成人国产精品免费观看| 91国偷自产一区二区三区成为亚洲经典 | 岛国一区二区在线观看| 99久久婷婷国产综合精品电影 | 欧美电影免费提供在线观看| 26uuu精品一区二区| 国产精品嫩草久久久久| 一区二区三区四区蜜桃| 日本视频中文字幕一区二区三区| 久久99精品国产91久久来源| 高清成人免费视频| 欧美性生活影院| 欧美一级免费观看| 欧美韩日一区二区三区| 亚洲一区二区欧美| 精品一区二区三区久久久| 成人午夜在线视频| 欧美三电影在线| 26uuu久久天堂性欧美| 亚洲视频小说图片| 日本亚洲免费观看| 成人精品国产福利| 3atv一区二区三区| 国产精品国产三级国产三级人妇 | 国产精品一区三区| 色婷婷国产精品久久包臀| 欧美一级夜夜爽| 综合久久久久综合| 六月丁香婷婷久久| 色诱亚洲精品久久久久久| 精品伦理精品一区| 亚洲国产日韩a在线播放性色| 国内精品免费**视频| 色综合中文字幕国产 | 国产成人在线观看| 欧美视频三区在线播放| 国产女人aaa级久久久级| 亚洲成人午夜电影| 高清免费成人av| 欧美一区二区免费观在线| 国产精品国产三级国产aⅴ无密码| 亚洲成人自拍偷拍| 99精品热视频| 国产人成一区二区三区影院| 秋霞成人午夜伦在线观看| 99麻豆久久久国产精品免费| 日韩精品中文字幕在线一区| 亚洲精品ww久久久久久p站| 国产乱人伦偷精品视频免下载| 欧美综合在线视频| 综合精品久久久| 国产一区在线精品| 日韩一区二区三区电影在线观看 | 国产91精品免费| 宅男在线国产精品| 亚洲一区国产视频| 色综合久久精品| 国产精品网站导航| 国内精品伊人久久久久影院对白| 7777精品伊人久久久大香线蕉超级流畅 | 丁香婷婷综合网| 欧美精品一区二区蜜臀亚洲| 婷婷一区二区三区| 欧美日韩中文字幕一区| 亚洲欧美中日韩| 成人手机在线视频| 国产亚洲视频系列| 极品美女销魂一区二区三区免费| 欧美精品xxxxbbbb| 五月婷婷综合网| 欧美影院午夜播放| 一区二区在线观看视频| 99精品欧美一区二区三区综合在线| 国产女人水真多18毛片18精品视频| 久久综合综合久久综合| 欧美一区二区三区男人的天堂| 亚洲高清不卡在线| 欧美日韩精品免费观看视频| 亚洲国产精品尤物yw在线观看| 色哟哟欧美精品| 亚洲人成网站在线| 一本久道中文字幕精品亚洲嫩| 日韩美女啊v在线免费观看| 不卡的av电影在线观看| 18成人在线观看| 一本色道亚洲精品aⅴ| 亚洲码国产岛国毛片在线| 91香蕉视频黄| 夜夜操天天操亚洲| 欧美日韩免费不卡视频一区二区三区| 亚洲高清一区二区三区| 7777精品伊人久久久大香线蕉的 | 色综合久久99| 亚洲成人精品一区二区| 欧美三级中文字幕在线观看| 日韩制服丝袜先锋影音| 7878成人国产在线观看| 毛片基地黄久久久久久天堂| 精品国产第一区二区三区观看体验| 国产在线视频精品一区| 国产日韩高清在线| 色一区在线观看| 日韩av高清在线观看| 精品国精品自拍自在线| 福利一区在线观看| 亚洲九九爱视频| 制服丝袜中文字幕一区| 精品系列免费在线观看| 国产精品五月天| 色88888久久久久久影院按摩| 亚洲成在人线在线播放| 精品久久免费看| 成人av免费在线观看| 亚洲综合999| 日韩欧美资源站| 成人少妇影院yyyy| 亚洲一区二区三区在线播放| 日韩一区二区三区观看| 成人污视频在线观看| 午夜精品福利一区二区蜜股av | 国产精品私房写真福利视频| 欧美性高清videossexo| 久久电影国产免费久久电影| 国产精品毛片高清在线完整版| 欧美性三三影院| 国产一区二区在线电影| 亚洲精品视频免费观看| 欧美成人a视频| 99精品久久久久久| 久久99久久精品| 亚洲欧美乱综合| 欧美成人video| 在线视频一区二区三区| 激情综合色播激情啊| 一区二区在线观看不卡| 久久影院午夜论| 欧美日韩一区二区三区四区五区 | 日本黄色一区二区| 韩国一区二区视频| 亚洲午夜精品17c| 国产女主播在线一区二区| 欧美精品123区| 99国产一区二区三精品乱码| 久久97超碰色| 亚洲国产综合91精品麻豆| 国产精品女人毛片| 精品va天堂亚洲国产| 欧美最猛性xxxxx直播| 成人精品国产福利| 精品一区二区三区免费视频| 亚洲主播在线播放| 中文字幕一区二区三区在线观看| 精品久久久久久久一区二区蜜臀| 欧美综合视频在线观看| 成人av影视在线观看| 国产乱色国产精品免费视频| 日本最新不卡在线| 亚洲精品乱码久久久久久| 久久久久久久网| 精品三级在线观看| 91精品国产入口| 在线免费亚洲电影| 91免费观看视频在线| 成人性色生活片免费看爆迷你毛片| 日本特黄久久久高潮| 亚洲成人综合在线| 亚洲图片自拍偷拍| 亚洲精品国产成人久久av盗摄| 欧美极品少妇xxxxⅹ高跟鞋| 欧美精品一区二区久久婷婷| 日韩久久久精品| 4hu四虎永久在线影院成人| 欧美日韩日日骚| 欧美亚洲综合色| 欧美天堂一区二区三区| 欧洲一区在线观看| 在线观看中文字幕不卡| 色成年激情久久综合|