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

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

?? module3.lst

?? Mcgraw-Hill - Java 2 - A Beginner S Guide, 2Nd Ed - 2003 -prog.
?? LST
?? 第 1 頁 / 共 2 頁
字號:
listing 1
// Read a character from the keyboard. 
class KbIn {   
  public static void main(String args[])   
    throws java.io.IOException { 
 
    char ch; 
 
    System.out.print("Press a key followed by ENTER: "); 
 
    ch = (char) System.in.read(); // get a char 
    
    System.out.println("Your key is: " + ch); 
  }   
}

listing 2
// Guess the letter game.  
class Guess {   
  public static void main(String args[])   
    throws java.io.IOException { 
 
    char ch, answer = 'K'; 
 
    System.out.println("I'm thinking of a letter between A and Z."); 
    System.out.print("Can you guess it: "); 
 
    ch = (char) System.in.read(); // read a char from the keyboard 
    
    if(ch == answer) System.out.println("** Right **"); 
  }   
}

listing 3
// Guess the letter game, 2nd version.  
class Guess2 {   
  public static void main(String args[])   
    throws java.io.IOException { 
 
    char ch, answer = 'K'; 
 
    System.out.println("I'm thinking of a letter between A and Z."); 
    System.out.print("Can you guess it: "); 
 
    ch = (char) System.in.read(); // get a char 
    
    if(ch == answer) System.out.println("** Right **"); 
    else System.out.println("...Sorry, you're wrong."); 
  }   
}

listing 4
// Guess the letter game, 3rd version.  
class Guess3 {   
  public static void main(String args[])   
    throws java.io.IOException { 
 
    char ch, answer = 'K'; 
 
    System.out.println("I'm thinking of a letter between A and Z."); 
    System.out.print("Can you guess it: "); 
 
    ch = (char) System.in.read(); // get a char 
    
    if(ch == answer) System.out.println("** Right **"); 
    else { 
      System.out.print("...Sorry, you're "); 
 
      // a nested if 
      if(ch < answer) System.out.println("too low"); 
      else System.out.println("too high"); 
    } 
  }   
}

listing 5
// Demonstrate an if-else-if ladder.  
class Ladder {    
  public static void main(String args[]) {    
    int x; 
  
    for(x=0; x<6; x++) {  
      if(x==1) 
        System.out.println("x is one");  
      else if(x==2)  
        System.out.println("x is two"); 
      else if(x==3)  
        System.out.println("x is three");  
      else if(x==4)  
        System.out.println("x is four");  
      else  
        System.out.println("x is not between 1 and 4");  
    }  
  } 
}

listing 6
// Demonstrate the switch. 
class SwitchDemo {   
  public static void main(String args[]) { 
    int i; 
 
    for(i=0; i<10; i++) 
      switch(i) { 
        case 0:  
          System.out.println("i is zero"); 
          break; 
        case 1:  
          System.out.println("i is one"); 
          break; 
        case 2:  
          System.out.println("i is two"); 
          break; 
        case 3:  
          System.out.println("i is three"); 
          break; 
        case 4:  
          System.out.println("i is four"); 
          break; 
        default:  
          System.out.println("i is five or more"); 
      } 
      
  }   
}

listing 7
// Demonstrate the switch without break statements. 
class NoBreak {   
  public static void main(String args[]) { 
    int i; 
 
    for(i=0; i<=5; i++) { 
      switch(i) { 
        case 0:  
          System.out.println("i is less than one"); 
        case 1:  
          System.out.println("i is less than two"); 
        case 2:  
          System.out.println("i is less than three"); 
        case 3:  
          System.out.println("i is less than four"); 
        case 4:  
          System.out.println("i is less than five"); 
      } 
      System.out.println(); 
    } 
  }   
}

listing 8
switch(i) { 
  case 1: 
  case 2: 
  case 3: System.out.println("i is 1, 2 or 3"); 
    break; 
  case 4: System.out.println("i is 4"); 
    break; 
}

listing 9
switch(ch1) { 
  case 'A': System.out.println("This A is part of outer switch."); 
    switch(ch2) { 
      case 'A':  
        System.out.println("This A is part of inner switch"); 
        break; 
      case 'B': // ... 
    } // end of inner switch 
    break; 
  case 'B': // ...

listing 10
/* 
   Project 3-1 
 
   A simple help system. 
*/ 
class Help { 
  public static void main(String args[])  
    throws java.io.IOException { 
    char choice; 
 
    System.out.println("Help on:"); 
    System.out.println("  1. if"); 
    System.out.println("  2. switch"); 
    System.out.print("Choose one: "); 
    choice = (char) System.in.read(); 
 
    System.out.println("\n"); 
  
    switch(choice) { 
      case '1': 
        System.out.println("The if:\n"); 
        System.out.println("if(condition) statement;"); 
        System.out.println("else statement;"); 
        break; 
      case '2': 
        System.out.println("The switch:\n"); 
        System.out.println("switch(expression) {"); 
        System.out.println("  case constant:"); 
        System.out.println("    statement sequence"); 
        System.out.println("    break;"); 
        System.out.println("  // ..."); 
        System.out.println("}"); 
        break; 
      default: 
        System.out.print("Selection not found."); 
    } 
  } 
}

listing 11
// Show square roots of 1 to 99 and the rounding error. 
class SqrRoot {     
  public static void main(String args[]) {     
    double num, sroot, rerr;  
 
    for(num = 1.0; num < 100.0; num++) {  
      sroot = Math.sqrt(num); 
      System.out.println("Square root of " + num + 
                          " is " + sroot); 
 
      // compute rounding error 
      rerr = num - (sroot * sroot); 
      System.out.println("Rounding error is " + rerr); 
      System.out.println(); 
    }  
  }     
}

listing 12
// A negatively running for loop. 
class DecrFor {     
  public static void main(String args[]) {     
    int x; 
 
    for(x = 100; x > -100; x -= 5) 
      System.out.println(x); 
  }     
}

listing 13
for(count=10; count < 5; count++) 
  x += count; // this statement will not execute

listing 14
// Use commas in a for statememt.    
class Comma {    
  public static void main(String args[]) {    
    int i, j; 
 
    for(i=0, j=10; i < j; i++, j--) 
      System.out.println("i and j: " + i + " " + j); 
 
   
  }    
}

listing 15
// Loop until an S is typed. 
class ForTest {   
  public static void main(String args[])   
    throws java.io.IOException { 
 
    int i; 
 
    System.out.println("Press S to stop."); 
 
    for(i = 0; (char) System.in.read() != 'S'; i++) 
      System.out.println("Pass #" + i); 
  }   
}

listing 16
// Parts of the for can be empty. 
class Empty {   
  public static void main(String args[]) { 
    int i; 
 
    for(i = 0; i < 10; ) { 
      System.out.println("Pass #" + i); 
      i++; // increment loop control var 
    } 
  }   
}

listing 17
// Move more out of the for loop. 
class Empty2 {   
  public static void main(String args[]) { 
    int i; 
 
    i = 0; // move initialization out of loop 
    for(; i < 10; ) { 
      System.out.println("Pass #" + i); 
      i++; // increment loop control var 
    } 
  }   
}

listing 18
// The body of a loop can be empty. 
class Empty3 {   
  public static void main(String args[]) { 
    int i; 
    int sum = 0; 
 
    // sum the numbers through 5  
    for(i = 1; i <= 5; sum += i++) ; 
 
    System.out.println("Sum is " + sum); 
  }   
}

listing 19
// Declare loop control variable inside the for. 
class ForVar {   
  public static void main(String args[]) { 
    int sum = 0; 
    int fact = 1; 
 
    // compute the factorial of the numbers through 5  
    for(int i = 1; i <= 5; i++) {  
      sum += i;  // i is known throughout the loop 
      fact *= i; 
    } 
 
    // but, i is not known here. 
 
    System.out.println("Sum is " + sum); 
    System.out.println("Factorial is " + fact); 
  }   
}

listing 20
// Demonstrate the while loop. 
class WhileDemo {   
  public static void main(String args[]) { 
    char ch; 
 
    // print the alphabet using a while loop 
    ch = 'a'; 
    while(ch <= 'z') { 
      System.out.print(ch); 
      ch++; 
    } 
  }   
}

listing 21
// Compute integer powers of 2. 
class Power {   
  public static void main(String args[]) { 
    int e; 
    int result; 
 
    for(int i=0; i < 10; i++) { 
      result = 1; 
      e = i; 
      while(e > 0) { 
        result *= 2; 
        e--; 
      } 
 
      System.out.println("2 to the " + i +  
                         " power is " + result);        
    } 
  }   
} 


listing 22
// Demonstrate the do-while loop. 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色视频一区二区| 亚洲国产精华液网站w| 久久久久一区二区三区四区| 日韩理论片在线| 捆绑调教美女网站视频一区| 99精品久久免费看蜜臀剧情介绍| 欧美一区二区在线不卡| 日韩欧美视频在线| 一区二区三区在线视频观看58| 久久99精品国产麻豆不卡| 日本乱人伦aⅴ精品| 国产精品蜜臀在线观看| 久久疯狂做爰流白浆xx| 911精品产国品一二三产区| 亚洲精品亚洲人成人网在线播放| 国产剧情av麻豆香蕉精品| 日韩一区二区影院| 亚洲成人你懂的| 在线观看视频一区| 国产精品女主播av| 国产麻豆精品一区二区| 精品久久久久久久人人人人传媒 | 五月婷婷综合激情| 欧美日韩午夜在线视频| 欧美精品日韩精品| 国产精品亲子乱子伦xxxx裸| 成人国产精品免费观看视频| 国产日韩欧美不卡在线| 日本不卡视频在线| 制服丝袜亚洲色图| 免费在线欧美视频| 日韩写真欧美这视频| 奇米一区二区三区av| 6080日韩午夜伦伦午夜伦| 日韩影院免费视频| 91精品国产综合久久精品麻豆| 亚洲自拍偷拍网站| 欧美日韩成人在线| 视频一区二区三区入口| 91麻豆精品国产自产在线 | 欧美日韩国产一级片| 一区二区激情小说| 精品视频一区 二区 三区| 亚洲精品乱码久久久久久| 欧美在线啊v一区| 午夜伊人狠狠久久| 日韩美一区二区三区| 国产乱妇无码大片在线观看| 国产精品午夜免费| 在线国产亚洲欧美| 蜜桃久久久久久久| 国产精品色在线观看| 色哟哟国产精品免费观看| 午夜成人免费电影| 久久久www成人免费无遮挡大片| 大白屁股一区二区视频| 亚洲乱码精品一二三四区日韩在线 | 99vv1com这只有精品| 亚洲国产精品久久人人爱蜜臀| 欧美女孩性生活视频| 国产伦理精品不卡| 亚洲视频一区二区免费在线观看| 欧美色窝79yyyycom| 国产一区二区三区四区五区美女| 中文字幕亚洲综合久久菠萝蜜| 欧美视频一区在线| 国模无码大尺度一区二区三区| 成人免费在线观看入口| 777a∨成人精品桃花网| 不卡一卡二卡三乱码免费网站| 亚洲一区二区三区中文字幕| xnxx国产精品| 欧美日韩美少妇| 国产iv一区二区三区| 石原莉奈在线亚洲二区| 国产精品久久久久久久久免费桃花| 国产亚洲欧美色| 色狠狠av一区二区三区| 国内精品国产成人国产三级粉色 | 国产一二精品视频| 一区二区三区蜜桃网| 2023国产精华国产精品| 欧美视频一区在线| 99精品欧美一区| 国内精品伊人久久久久av一坑| 亚洲一区二区三区中文字幕在线 | 国产成人在线网站| 日韩精品一级中文字幕精品视频免费观看 | 不卡一区二区在线| 久久99精品国产麻豆婷婷洗澡| 亚洲一二三区在线观看| 中文字幕精品一区二区精品绿巨人| 欧美高清www午色夜在线视频| 国产69精品久久久久毛片| 免费成人你懂的| 午夜精品一区在线观看| 亚洲精品网站在线观看| 中文字幕一区二区三区蜜月| 久久精品亚洲乱码伦伦中文| 欧美一区二区三区视频| 欧美色男人天堂| 一本久久a久久精品亚洲| 成人av电影在线网| 国产福利一区在线观看| 国产精品性做久久久久久| 久久av老司机精品网站导航| 免费三级欧美电影| 五月激情六月综合| 亚洲电影视频在线| 亚洲图片欧美色图| 亚洲aⅴ怡春院| 天天色天天操综合| 午夜不卡av免费| 天堂久久久久va久久久久| 亚洲一级片在线观看| 亚洲已满18点击进入久久| 国产精品正在播放| 成人看片黄a免费看在线| 国产成人免费视频网站高清观看视频| 国产精品自产自拍| 国产成人精品一区二| 成人av网站免费观看| 99视频精品免费视频| 91国内精品野花午夜精品 | 性欧美大战久久久久久久久| 五月综合激情婷婷六月色窝| 青青草97国产精品免费观看无弹窗版 | 欧美日精品一区视频| 9191成人精品久久| 精品免费日韩av| 国产欧美日韩在线视频| 日韩美女视频一区| 午夜精品久久久久久久久| 日本不卡视频在线观看| 国产福利精品导航| 99精品欧美一区二区蜜桃免费| 色猫猫国产区一区二在线视频| 欧美三级视频在线| 日韩美女视频一区二区在线观看| 精品国产成人系列| 中文字幕一区av| 亚欧色一区w666天堂| 黄一区二区三区| voyeur盗摄精品| 欧美精品丝袜久久久中文字幕| 久久亚洲一区二区三区四区| 国产精品嫩草影院com| 性感美女极品91精品| 国产精品99久久不卡二区| 欧洲视频一区二区| 日韩欧美国产午夜精品| 国产精品视频第一区| 日韩精品福利网| 4438x亚洲最大成人网| 国产精品毛片久久久久久久| 一区二区三区不卡在线观看| 久久电影网电视剧免费观看| 91在线观看高清| 亚洲精品一区二区三区在线观看 | 亚洲精品一区二区在线观看| 亚洲人亚洲人成电影网站色| 麻豆高清免费国产一区| 91免费版在线| 国产亚洲成年网址在线观看| 亚洲成人免费看| 成人国产精品免费观看视频| 精品奇米国产一区二区三区| 一区二区在线观看视频| 国产91色综合久久免费分享| 欧美一区二区三区公司| 亚洲品质自拍视频| 成人国产亚洲欧美成人综合网| 日韩欧美亚洲一区二区| 亚洲国产成人av| 色噜噜狠狠成人中文综合| 久久久91精品国产一区二区三区| 亚洲成人777| 欧美特级限制片免费在线观看| 国产精品午夜久久| 国产一区免费电影| 67194成人在线观看| 亚洲一区二区成人在线观看| av男人天堂一区| 欧美韩日一区二区三区四区| 狠狠色丁香婷综合久久| 日韩一区二区麻豆国产| 亚洲国产一区在线观看| 91丨porny丨国产| 综合精品久久久| 99久久综合国产精品| 亚洲国产精品t66y| 成人av网站在线| 国产精品久久久久久久蜜臀| 国产精品一区二区你懂的| 日韩欧美国产不卡| 久久99精品久久久久久国产越南| 欧美一级片在线| 裸体一区二区三区| 日韩精品一区二区三区四区| 美女在线视频一区|