欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

單詞簿java代碼 java中英語單詞

java實(shí)現(xiàn)按詞頭、詞尾提取英文文檔中的單詞的完整代碼代碼

public?class?Test?{

創(chuàng)新互聯(lián)主要為客戶提供服務(wù)項(xiàng)目涵蓋了網(wǎng)頁視覺設(shè)計(jì)、VI標(biāo)志設(shè)計(jì)、營銷推廣、網(wǎng)站程序開發(fā)、HTML5響應(yīng)式重慶網(wǎng)站建設(shè)手機(jī)網(wǎng)站制作設(shè)計(jì)、微商城、網(wǎng)站托管及網(wǎng)站維護(hù)、WEB系統(tǒng)開發(fā)、域名注冊(cè)、國內(nèi)外服務(wù)器租用、視頻、平面設(shè)計(jì)、SEO優(yōu)化排名。設(shè)計(jì)、前端、后端三個(gè)建站步驟的完善服務(wù)體系。一人跟蹤測(cè)試的建站服務(wù)標(biāo)準(zhǔn)。已經(jīng)為成都陽臺(tái)護(hù)欄行業(yè)客戶提供了網(wǎng)站開發(fā)服務(wù)。

public?static?void?main(String[]?args)?{

Test?t?=new?Test();

File?file?=?new?File("E:\\桌面\\words.txt");

try?{

ListString?list=?t.getWords(file,?true,"h");

for?(String?string?:?list)?{

System.out.print(string+"???");

}

}?catch?(Exception?e)?{

e.printStackTrace();

}

}

/**

?*?java實(shí)現(xiàn)按詞頭、詞尾提取英文文檔中的單詞

?*?@param?file?原文件

?*?@param?isHead?按詞頭true?按詞尾false

?*?@param?fix?關(guān)鍵詞

?*?@return

?*?@throws?Exception?

?*/

public?ListString?getWords(File?file?,?boolean?isHead,String?fix)?throws?Exception{

//讀取文件中的內(nèi)容到字符串str

FileInputStream?fis?=?new?FileInputStream(file);

BufferedInputStream?bis?=?new?BufferedInputStream(fis);

int?i=0;

String?str?=?"";

while?((i=bis.read())!=-1)?{

str+=(char)i;

}

System.out.println(str);

bis.close();

fis.close();

//將str分割為單詞數(shù)組

String[]?words?=?str.split("?");

ListString?list?=?new?ArrayListString();

if?(isHead)?{

for?(String?word?:?words)?{

if?(word.startsWith(fix))?{

list.add(word);

}

}

}else?{

for?(String?word?:?words)?{

if?(word.endsWith(fix))?{

list.add(word);

}

}

}

return?list;

}

}

求一個(gè)JAVA猜單詞游戲的代碼,要求如下

import?java.util.Random;

import?java.util.Scanner;

public?class?GuessString?{

public?static?void?main(String[]?args){

String[]?strings={"apple","orange","tom","kitty","hello","world","have","fun","hehe","ok"};

Random?rand=new?Random();

String?choosed=strings[rand.nextInt()%10];

StringBuilder?guessString=new?StringBuilder(choosed);

StringBuilder?sb=new?StringBuilder();

for(int?i=0;iguessString.length();i++)

sb.append("_?");

System.out.println(sb);

Scanner?scanner=new?Scanner(System.in);

int?numberGuessed=0;

while(numberGuessedguessString.length()){

char?c=scanner.next().charAt(0);

int?index=guessString.indexOf(c+"");

if(index=0){

if(sb.charAt(2*index)=='_'){

guessString.setCharAt(index,?'*');

sb.setCharAt(index*2,?c);

numberGuessed++;

}

}

System.out.println(sb);

}

}

}

簡(jiǎn)易電子詞典 無需數(shù)據(jù)庫 用map添加單詞及含義的 java源代碼

public class Test4 {

static MapString, String map = new TreeMapString, String();

static {

map.put("watermelon", "西瓜");

map.put("banana", "香蕉");

map.put("strawberry", "草莓");

map.put("apple", "蘋果");

}

public static void main(String[] args) {

System.out.println("請(qǐng)輸入單詞");

Scanner sc = new Scanner(System.in);

while (sc.hasNext()) {

String str1 = sc.nextLine();

if(str1.equals("退出")){

return;

}

else if (map.containsKey(str1)) {

System.out.println(map.get(str1));

} else{

System.out.println("次單詞為新詞,添加意思");

Scanner sc1 = new Scanner(System.in);

String str2=sc1.nextLine();

map.put(str1, str2);

System.out.println("添加成功。");

}

}

}

}

當(dāng)前標(biāo)題:單詞簿java代碼 java中英語單詞
標(biāo)題鏈接:http://chinadenli.net/article38/dojggpp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計(jì)靜態(tài)網(wǎng)站服務(wù)器托管電子商務(wù)域名注冊(cè)網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站