freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java編程題全集100題及答案1(編輯修改稿)

2025-07-20 08:34 本頁面
 

【文章內(nèi)容簡介】 s2)。 f1 = (s1)。 f2 = (s2)。 ss = strAdd(s1,s2)。 si = strAdd(i1,i2)。 sf = strAdd(f1,f2)。 (輸入的二個字符串相加結(jié)果為:+ss )。 (輸入字符串轉(zhuǎn)換為整數(shù)相加結(jié)果為:+si )。 (輸入字符串轉(zhuǎn)換為浮點數(shù)相加結(jié)果為:+sf )。 } static String strAdd(String str1,String str2) {return str1+str2。}static String strAdd(int int1,int int2) {return (int1+int2)。}static String strAdd(float flt1,float flt2) {return (flt1+flt2)。} } 應(yīng)用FileInputStream類,編寫應(yīng)用程序,從磁盤上讀取一個Java程序,并將源程序代碼顯示在屏幕上。(被讀取的文件路徑為:E:/myjava/)// Programme Name import .*。 public class FISDemo { public static void main(String args[]) { byte[] buf=new byte[2056]。 try{ FileInputStream fileIn=new FileInputStream(e:/myjava/)。 int bytes=(buf,0,2056)。 String str=new String(buf,0,bytes)。 (str)。}catch(Exception e){ ( )。}} 編寫一個Java程序?qū)?dāng)100,101,102,103,104,,并以相反的順序讀出顯示在屏幕上。(文件)import .*。 public class IODemo { public static void main( String args[] ) { int data[] = {100,101,102,103,104,105}。 int[] t=new int[200]。 try{ // File file=new File()。 DataOutputStream out = new DataOutputStream (new FileOutputStream())。 for(int i=0。i。i++) (data[i])。寫入 ()。 DataInputStream in = new DataInputStream (new FileInputStream())。 //先讀出來再倒序輸出 for(int i=0。i。i++) { t[i]=()。 } for(int i= 。i= 0。i) { ( +t[i])。 } /* for(int i= 。i= 0。i) { t=(data[i])。 ( +t)。 }*/ ( )。 ()。 }catch(IOException e) { (())。} } }1 編寫一個Java程序?qū)崿F(xiàn)多線程,在線程中輸出線程的名字,隔300毫秒輸出一次,共輸出20次。// programme name TestThread。 // 聲明一個子線程類Threaddemo。 class ThreadDemo extends Thread { public ThreadDemo(String str) {super(str)。} public void run() { for(int i=0。i20。i++){(“ ”+())。Try { Sleep(300)。}catch(InterruptedException e){ (())。 Return。}}(“ /end”)。}}public class TestThread { public static void main( String args[] ) { ThreadDemo thread1=new ThreadDemo(“T1”)。 ThreadDemo thread2=new ThreadDemo(“T2”)。 ThreadDemo thread3=new ThreadDemo(“T3”)。 ()。 ()。 ()。 }}10. 編寫程序,在屏幕上顯示帶標(biāo)題的窗口,并添加一個按鈕。當(dāng)用戶單擊按鈕時,結(jié)束程序。(窗體編程)// Programme Name import .*。import .*。public class ButtonEventDemo extends JPanel implements ActionListener{protected JButton b1。 //聲明一個按鈕對象public ButtonEventDemo() { //構(gòu)造方法ImageIcon ButtonIcon
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1