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

正文內(nèi)容

期末復(fù)習(xí)java題-資料下載頁

2025-04-17 02:51本頁面
  

【正文】 a[i]=a[j]。 a[j]=k。 } } } (成績排名為:)。 for (int j = 0。 j 。 j++) { (a[j])。} } for(int j=0。j。j++){ if(a[j]max){ max=a[j]。 } if(a[j]min){ min=a[j]。 } sum+=a[j]。 } (最高分?jǐn)?shù):+max)。 (最低數(shù)+min)。 (平均分?jǐn)?shù):+sum/s)。 } },類名為WordCount,統(tǒng)計(jì)單詞“hello”在一篇英文文章()中出現(xiàn)的次數(shù),要求統(tǒng)計(jì)時(shí)忽略單詞的大小寫,統(tǒng)計(jì)結(jié)果在屏幕上打印出來的格式為:單詞***在文章***中出現(xiàn)的次數(shù)為:10。提示:下面是String類中的幾個(gè)方法:public int indexOf(String str) //返回指定子字符串在此字符串中第一次出現(xiàn)處的索引。public int indexOf(String str,int fromIndex) //從指定的索引開始,返回指定子字符串在此字符串中第一次出現(xiàn)處的索引。public String toUpperCase()//String中的所有字符都轉(zhuǎn)換為大寫public String toLowerCase ()//String中的所有字符都轉(zhuǎn)換為小寫package z4。import 。import 。import 。public class HelloCount {int getHelloCount(String aritleName,String hello) { int count=0。 String sentense。 try{ BufferedReader br=new BufferedReader(new FileReader(aritleName))。 hello=()。 while((sentense=())!=null){ (sentense)。 sentense=()。 int index=(hello)。 while(index=0){ count++。 index=(hello,index+())。 } } }catch (Exception e) { (文件目錄錯(cuò)誤)。 } return count。 }public static void main(String[] args) throws IOException { String article=./src/。 String hello=hello。 HelloCount h=new HelloCount()。 (單詞+hello+在文章中出現(xiàn)的次數(shù):+(article, hello))。 } }4. :從鍵盤輸入若行文字(可能包含中文),當(dāng)最后一行輸入quit時(shí),退出程序且將輸入內(nèi)容除quit外全部存入文件c:\package z5。import 。import 。import 。import 。import 。public class WriteLog { private static PrintWriter out。 public static void main(String[] args) { try { out = new PrintWriter(new OutputStreamWriter(new FileOutputStream( c://)))。 } catch (FileNotFoundException e) { ()。 } Scanner in = new Scanner()。 String line =null。 while (!quit.equals(line = ())) { (line)。 } ()。 ()。 }}1. 編寫程序:使用字符輸入、輸出流讀取文件,將一段文字加密后存入文件,然后再讀取,并將加密前與加密后的文件輸出。package IOTest。import 。import 。import 。import 。import 。import 。import 。import 。public class Jiami { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new FileReader(new File(./) ))。 BufferedWriter bw=new BufferedWriter(new FileWriter(new File(./),true))。 Scanner scan=new Scanner()。 String str=()。 char []c=()。 ()。 char []w=new char[]。 for (int i = 0。 i 。 i++) { w[i]=c[]。 } (w)。 ()。 String str2=()。 char []c2=()。 for (int i = 0。 i 。 i++) { (c2[])。 } ()。 }}2. 編寫程序:實(shí)現(xiàn)當(dāng)用戶輸入姓名和密碼時(shí),將每一個(gè)姓名和密碼加在文件中,如果用戶輸入done,就結(jié)束程序。package z5。import 。import 。import 。import 。import 。public class WriteLog { private static PrintWriter out。 public static void main(String[] args) { try { out = new PrintWriter(new OutputStreamWriter(new FileOutputStream( ./src/)))。 } catch (FileNotFoundException e) { ()。 } (請(qǐng)輸入用戶名和密碼,中間用逗號(hào)隔開。結(jié)束輸入時(shí)輸入‘done’)。 Scanner in = new Scanner()。 String line =null。 while (!done.equals(line = ())) { (line)。 } ()。 ()。 }}:輸入兩個(gè)正整數(shù)m和n,求其最大公約數(shù)和最小公倍數(shù)。package z5。import 。public class Sz { public static void main(String[] args) { int a, b, m。 Scanner s = new Scanner()。 (輸入一個(gè)整數(shù): )。 a = ()。 (輸鍵入一個(gè)整數(shù): )。 b = ()。 deff cd = new deff()。 m = (a, b)。 int n = a * b / m。 (最大公約數(shù): + m)。 (最小公倍數(shù): + n)。 }}class deff { public int deff(int x, int y) { int t。 if (x y) { t = x。 x = y。 y = t。 } while (y != 0) { if (x == y) return x。 else { int k = x % y。 x = y。 y = k。 } } return x。 }}5. 編寫程序:輸入一行字符,分別統(tǒng)計(jì)出其中英文字母、空格、數(shù)字和其它字符的個(gè)數(shù)。package z5。import 。public class T3 {public static void main(String[] args) { (請(qǐng)輸入一個(gè)字符串)。 Scanner sc=new Scanner()。 String str =()。 char ch [] = new char[()]。 ch=()。 int eng=0 ,kong=0,shu=0,qi=0。 for (int i = 0。 i 。 i++) { if (65ch[i] amp。amp。 ch[i]122) { eng++。 }if (48ch[i] amp。amp。 ch[i]57) { shu++。 } if (ch[i]==32) { kong++。 } if (48ch[i] amp。amp。 ch[i]122amp。amp。 ch[i]!=32) { qi++。 } } (英文字母有+eng)。 (空格有+kong)。 (數(shù)字有+shu)。 (其他字符有+qi)。}}一、數(shù)據(jù)庫綜合應(yīng)用練習(xí)1:,表名為student,其結(jié)構(gòu)為:學(xué)號(hào)(num)、姓名(name)、性別(sex)、年齡(age)、成績(score)(自己設(shè)計(jì)具體數(shù)據(jù)內(nèi)容):05,李芳,女,20,7606,張良,男,19,70package a1。import 。import 。import 。import 。import 。import 。import 。public class JDBCUtils { private static String url = jdbc:sqlserver://localhost:1433。DatabaseName=student。 private static String driver = 。 private static String user = sa。 private static String password =123456。 static{ try{ (driver)。 }catch(ClassNotFoundException e){ (找不到驅(qū)動(dòng)程序類 ,加載驅(qū)動(dòng)失??!)。 () 。 } } public static Connection getConnection() throws SQLException{ return (url, user, password)。 } public static void release(Connection conn,Statement st,ResultSet rs){ if(rs!=null){ try{ ()。 }catch (Exception e) { ()。 }finally{ if(st!=null){ try{ ()。 }catch (Exception e) { ()。 }finally{ if(conn!=null){ try{ ()。 }catch (Exception e) { ()。 }finally{ } } } } } } }}package a1。import .*。public class JdbcXianshi {public static void main(String[] args) { Connection conn = null。 PreparedStatement st = null。 ResultSet rs = null。 try { conn =()。 String str=select * from student order by num。 st = (str)。 rs = ()。 while (()) { ((num))。 ((name))。 ((sex))。 ((age))。 ((score))。 } } catch (SQLException e) { // TODO Autogenerated catch block ()。 } finally { (conn, st, rs)。 }}}package a1。import 。import 。import 。import 。public class Add {public static void mai
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1