日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Teach Yourself Java 2 in 21 Days 书中样例代码实践

發(fā)布時間:2023/12/10 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Teach Yourself Java 2 in 21 Days 书中样例代码实践 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

找了好幾書JAVA的書,看了幾章,都看不下去。

我覺得適合《Teach Yourself Java 2 in 21 Days》(Rogers Cadenhead Laura Lemay)還是適合我的。

孫衛(wèi)琴那本,我感覺就羅嗦多了沒到我點子上。

接口,抽象類這些內容講得通俗易懂,看著不費力。

代碼:

1 class VolcanoRobot { 2 String status; 3 int speed; 4 float temperature; 5 6 void checkTemperature() { 7 if (temperature > 660) { 8 status = "returning home."; 9 speed = 5; 10 } 11 } 12 13 void showAttributes() { 14 System.out.println("Status: " + status); 15 System.out.println("Speed: " + speed); 16 System.out.println("Temperature: " + temperature); 17 } 18 }

?

1 class VolcanoApplication { 2 public static void main(String[] arguments) { 3 VolcanoRobot dante = new VolcanoRobot(); 4 dante.status = "exploring"; 5 dante.speed = 2; 6 dante.temperature = 510; 7 8 dante.showAttributes(); 9 System.out.println("Increasing speed to 3."); 10 dante.speed = 3; 11 dante.showAttributes(); 12 System.out.println("Changing temperature to 670."); 13 dante.temperature = 670; 14 dante.showAttributes(); 15 System.out.println("Checking the temperature."); 16 dante.checkTemperature(); 17 dante.showAttributes(); 18 } 19 }

?

運行:

?

轉載于:https://www.cnblogs.com/aguncn/archive/2013/03/28/2986637.html

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結

以上是生活随笔為你收集整理的Teach Yourself Java 2 in 21 Days 书中样例代码实践的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。