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

正文內容

java經典的小程序詳盡代碼-資料下載頁

2025-07-07 11:50本頁面
  

【正文】 turn name。} public void setName(String name) { = name。} public int getAge() {return age。} public void setAge(int age) { = age。}}class TestHashMap{ public static void main(String[] args) { HashMap hm = new HashMap()。 Student s1 = new Student(1,jacky,19)。 (jacky,s1)。 (tom,new Student(2,tom,21))。 (kitty,new Student(3,kitty,17))。 Iterator it = ().iterator()。 while(()){ Object key = ()。 Student value = (Student) (key)。 (key+:id=++,age=+)。 } (=============================)。 //比較 KeySet() 和 entrySet() 兩種迭代方式 for(Iterator i1 = ().iterator()。 ()。 ) { me = () ()。 Student s = (Student) ()。 (()+: id=++ age=+)。 } }}day13 homework1./**********************************************************************************自己寫一個棧: ( 先進后出 ) 建議底層用LinkedList實現參照 方法: boolean empty() 測試堆棧是否為空。 E peek() 查看棧頂對象而不移除它。 E pop() 移除棧頂對象并作為此函數的值返回該對象。 E push(E item) 把項壓入棧頂。 int search(Object o) 返回對象在棧中的位置,以 1 為基數。***************************************************************************************///不能用繼承,因為它破壞封裝。只需調用即可import 。class MyStackE{ private LinkedListE list = new LinkedListE()。 public boolean empty() {return ()。} public E peek() {return ()。 } public E pop() {return ()。 } public void push(E o) {(o)。 } //int indexOf(Object o) 返回此列表中首次出現的指定元素的索引,如果此列表中不包含該元素,則返回 1。 public int search(Object o){return (o)。}}2. /***************************************************************************************定義以下類,完成后面的問題,并驗證。Exam類 考試類屬性: 若干學生 一張考卷提示:學生采用HashSet存放Paper類 考卷類 屬性:若干試題提示:試題采用HashMap存放,key為String,表示題號,value為試題對象Student類 學生類屬性:姓名 一張答卷 一張考卷 考試成績Question類 試題類屬性:題號 題目描述 若干選項 正確答案提示:若干選項用ArrayListAnswerSheet類 答卷類屬性:每道題的答案 提示:答卷中每道題的答案用HashMap存放,key為String,表示題號,value為學生的答案問題:為Exam類添加一個方法,用來為所有學生判卷,并打印成績排名(名次、姓名、成績)***************************************************************************************/3. /***************************************************************************************項目:商品管理系統(tǒng)功能:增刪改查 (可按各種屬性查)商品屬性:名稱、價格(兩位小數)、種類***************************************************************************************/day17 圖形界面1. 計算器/*****************例題 畫出計算器的界面*****************************界面如下: 1 2 3 + 4 5 6 7 8 9 * 0 . = / *******************/import .*。import .*。class Calculator { public static void main(String[] args){ JTextField text = new JTextField()。 JFrame f = new JFrame(計算器)。 Font font = new Font(宋體, , 25)。//宋體想寫成默認,則寫“null” (font)。 //定義字體 ()。//令text的文字從右邊起 (false)。//設置文本不可修改,默認可修改(true) (text, )。//Frame和Dialog的默認布局管理器是Border Layout ButtonActionListener listener = new ButtonActionListener(text)。//事件反應在text中 JPanel buttonPanel = new JPanel()。//設法把計算器鍵盤放到這個Jpanel按鈕上 String op = 123+456789*0.=/。 GridLayout gridlayout = new GridLayout(4,4,10,10)。 (gridlayout)。//把計算器鍵盤放到buttonPanel按鈕上 for(int i=0。 i()。 i++){ char c = (i)。 //拿到字符串的第i個字符 JButton b = new JButton(c+)。//把字符放到按鈕上 (listener)。//在按鈕上放置監(jiān)聽器,每次按都會有反應 (b)。//把按鈕放到buttonPanel上 }//這個循環(huán)很值得學習,很常用 (buttonPanel/*, */)。 //默認添加到CENTER位置 ()。 (300, 250)。 (true)。//這句要放到最后,等事件完成后再顯示}}//監(jiān)聽者class ButtonActionListener implements ActionListener{ private JTextField textField。 public ButtonActionListener(JTextField textField) { = textField。 } public void actionPerformed(ActionEvent e) {//必須覆蓋它的actionPerformed() (哈哈,放了幾個字\n)。}}/*********************未實現計算器的具體功能*******************************/2. 掃雷游戲3. 俄羅斯方塊day19 多線程寫兩個線程,一個線程打印 1~52,另一個線程打印字母AZ。打印順序為12A34B56C……5152Z。要求用線程間的通信。 注:分別給兩個對象構造一個對象o,()。 ()()。class Test{ public static void main(String[] args) { Printer p = new Printer()。 Thread t1 = new NumberPrinter(p)。 Thread t2 = new LetterPrinter(p)。 ()。 ()。 } }class Printer{ private int index = 1。//設為1,方便計算3的倍數 //打印數字的構造方法,每打印兩個數字,等待打印一個字母 public synchronized void print(int i){ while(index%3==0){try{wait()。}catch(Exception e){}} ( +i)。 index++。 notifyAll()。 } //打印字母,每打印一個字母,等待打印兩個數字 public synchronized void print(char c){ while(index%3!=0){try{wait()。}catch(Exception e){}} ( +c)。 index++。 notifyAll()。 } }//打印數字的線程class NumberPrinter extends Thread{ private Printer p。 public NumberPrinter(Printer p){ = p。} public void run(){ for(int i = 1。 i=52。 i++){ (i)。 } }}//打印字母的線程class LetterPrinter extends Thread{ private Printer p。 public LetterPrinter(Printer p){ = p。} public void run(){ for(char c=39。A39。 c=39。Z39。 c++){ (c)。 } }}/*如果這題中,想保存需要打印的結果,可在Printer類里定義一個成員變量String s = 。 //不寫“”的話是null,null跟沒有東西是不一樣的,它會把null當成字符 =_=然后在兩個print()方法里面,while循環(huán)后分別加上 s = s + +i。 以及 s = s + + c。*/歡迎您的光臨,!希望您提出您寶貴的意見,你的意見是我進步的動力。贈語; 如果我們做與不做都會有人笑,如果做不好與做得好還會有人笑,那么我們索性就做得更好,來給人笑吧! 現在你不玩命的學,以后命玩你。我不知道年少輕狂,我只知道勝者為王。不要做金錢、權利的奴隸;應學會做“金錢、權利”的主人。什么時候離光明最近?那就是你覺得黑暗太黑的時候。最值得欣賞的風景,是自己奮斗的足跡。壓力不是有人比你努力,而是那些比你牛幾倍的人依然比你努力。學習資料
點擊復制文檔內容
試題試卷相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1