package?com.lp.test;
創新互聯建站長期為成百上千客戶提供的網站建設服務,團隊從業經驗10年,關注不同地域、不同群體,并針對不同對象提供差異化的產品和服務;打造開放共贏平臺,與合作伙伴共同營造健康的互聯網生態環境。為修水企業提供專業的成都網站設計、成都做網站、外貿網站建設,修水網站改版等技術服務。擁有10多年豐富建站經驗和眾多成功案例,為您定制開發。
public?class?StringTest?{
public?static?void?main(String[]?args)?{
//?TODO?code?application?logic?here
//打印main方法參數
if?(args.length??0)?{
for?(int?i?=?0;?i??args.length;?i++)?{
System.out.println(args[i]);
}
}?else?{
System.out.println("No?args.");
}
String?str?=?"12345";
//將str拆分為單個char輸出
for?(int?i?=?0;?i??str.length();?i++)?{
System.out.print(str.charAt(i)?+?"?");
}
System.out.println("");
//截取str前四位
str?=?str.substring(0,?4);
System.out.println(str);
//將截取后的str與"77777"進行拼接
str?=?str.concat("77777");
System.out.println(str);
//輸出7在str中第一次出現的位置
int?index?=?str.indexOf('7');
System.out.println(index);
//獲取7在str中最后一次出現的位置
int?lastIndex?=?str.lastIndexOf('7');
System.out.println(lastIndex);
//將str中的7全部換為6
str?=?str.replace('7',?'6');
System.out.println(str);
//將str中第一次出現的"6666"置換為"5"
str?=?str.replaceAll("6666",?"5");
System.out.println(str);
//初始化一個包含"12345"的字符串緩沖對象
StringBuilder?strb?=?new?StringBuilder("12345");
//循環輸出字符串緩沖對象的內容
for?(int?i?=?0;?i??strb.length();?i++)?{
System.out.print(strb.charAt(i)?+?"?");
}
System.out.println("");
//刪除strb中索引為4的字符
strb.deleteCharAt(4);
System.out.println(strb);
//在刪除字符后的strb中拼接"77777"
strb.append("77777");
System.out.println(strb);
//在索引為4芳容位置上插入"56";
strb.insert(4,?"56");
System.out.println(strb);
//顛倒strb中的字符順序
strb.reverse();
System.out.println(strb);
String?hello?=?"HelloWord";
//將hello字符串轉換為全小寫
System.out.println(hello.toLowerCase());
//將hello字符串轉換為全大寫
System.out.println(hello.toUpperCase());
}
}
沒有翻譯軟件,但是能編寫翻譯程序。
java 代碼翻譯實例:
1.輸入一個以’@’結束的字符串,從左至右翻譯。若下一個字符是數字n(0≤n≤9),表示后一個字符重復n+1 次,不論后一個字符是否為數字;若下一個字符非數字,則表示自己。
2.翻譯后,以3 個字符為一組輸出,組與組之間用空格分開。
例如’A2B5E34FG0ZYWPQ59R@’,翻成’ABB_BEE_EEE_E44_44F_GZY_WPQ_999_999_R@ ’。
3.分析:首先直接遍歷數組把字符串按要求進行翻譯,然后將翻譯后的字符串進行分組形成字符串數組,最后把字符串數組用下劃線連接輸出。
java翻譯源代碼:
import java.util.Scanner;
public class Main5{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.nextLine();
int length = s.length();
String result = "";
char[] str = new char[length]
for (int i = 0; i length; i++) {
str[i] = s.charAt(i);
}
result += str[0];
if (str[length - 1] != '@') {
System.out.println("輸入有誤!");
} else {
for (int index = 0; index length - 1;) {
if ('0' == str[index + 1] || '1' == str[index + 1] || '2' == str[index + 1] || '3' == str[index + 1]
|| '4' == str[index + 1] || '5' == str[index + 1] || '6' == str[index + 1]
|| '7' == str[index + 1] || '8' == str[index + 1] || '9' == str[index + 1]) {
for (int i = 0; i ((Integer.parseInt(str[index + 1]+"")) + 1); i++) {
result += str[index + 2];
}
index += 2;
} else {
result += str[index + 1];
index++;
}
}
}
System.out.println(getGroup(result));
}
//每3個分一組
public static String getGroup(String s){
String[] r;
if(s.length()%3 == 0){
r = new String[s.length()/3];
}else{
r = new String[s.length()/3+1];
}
String result = "";
int j = 0;
for(int i=0;is.length();){
if(i+3 = s.length()){
r[j]=s.substring(i, i+3);
j++;
i += 3;
}else{
r[j] = s.substring(i);
j++;
i += 3;
}
}
for(int i=0;ir.length-1;i++){
result += (r[i]+"_");
}
result += r[r.length-1];
return result;
}
}
Important: This is not a supported means of building Tomcat; this information is provided without warranty :-).重要:這不是一個建立Tomcat的支持手段,這方面的資料提供不附帶:-)。 The only supported means of building Tomcat is with the "ant build" described above. Tomcat的建設支持的唯一途徑是與“蟻建立上述”。 However, some developers like to work on Java code with a Java IDE, and the following steps have been used by some developers.但是,一些開發人員喜歡在Java代碼與一個Java IDE,和下面的步驟是由一些開發人員使用。
Note that you must complete all the above steps to fetch the repositories and build some JAR files the first time.請注意,您必須完成所有上述步驟獲取的資料庫和興建一些JAR文件的第一次。 After you have completed the above steps, you can set up a series of Eclipse 4 projects.在完成上述步驟后,您可以設置一個Eclipse的一系列4個項目。 Note that this will not let you build everything under Eclipse; the build process requires use of Ant for the many stages that aren't simple Java compilations.請注意,這不會讓你在Eclipse中建立的一切,在生成過程需要使用螞蟻的許多階段,這不是簡單的Java匯編。 However, it will allow you to view and edit the Java code, get warnings, reformat code, perform refactorings, run Tomcat under the IDE, and so on.但是,它可以讓你查看和編輯Java代碼,得到警告,重新格式化代碼,執行重構,在IDE下運行Tomcat的,等等。
You will want to set up your Eclipse project for building Tomcat such that ${tomcatSource} is the Workspace folder.您將要建立的Eclipse項目的建設,這樣Tomcat的$(tomcatSource)是工作區文件夾。
Use Windows-Preferences and then Java-Build Path-Classpath Variables to add two new Classpath variables:使用Windows -“首選項,然后Java的”構建路徑“類路徑變量增加兩個新的類路徑變量:
TOMCAT_LIBS_BASE the base path where the binary dependencies have been downloaded TOMCAT_LIBS_BASE基二元路徑依賴已下載
ANT_HOME the base path of Ant 1.6.2 or later ANT_HOME的螞蟻1.6.2或更高基路徑
Use File-New Project to create a new Java project for each of the binaries repository (eg, /usr/share/java), container, connectors, jasper, servletapi.使用文件“新建項目,以創造一個二進制庫的每一個新的Java項目(例如/ usr /共享/爪哇),容器,連接器,碧玉,servletapi。 If you didn't already set up the Eclipse project such that ${tomcat.source} is the Workspace folder, do so now: tell Eclipse the external location using "Import/Export...", General-Existing Project into Workspace.如果您沒有已成立Eclipse項目,這樣$(tomcat.source)是工作區文件夾,現在這樣做:告訴Eclipse的外部位置使用“導入/導出...",普通”到工作區現有項目。
Eclipse .project and .classpath files are provided in each of these directories so Eclipse should find all source trees and jars, and hopefully compile without problems.月食。項目。路徑文件提供了這些目錄之內,以便Eclipse應該找到所有源代碼樹及瓶子,并希望編譯沒有問題。 Note that these files assume you are using Eclipse with a 5.0 or later JDK; also, the connectors module must be built with a compiler compliance level of 5.0.請注意,這些文件假設您使用的5.0或更高版本的JDK Eclipse的;此外,連接器模塊必須用5.0編譯器的遵守程度上。
To run Tomcat without a special IDE plug-in, you can simply use Run-Run...若要運行沒有特殊的IDE插件Tomcat的,您可以簡單地使用運行“運行... enter "org.apache.catalina.startup.Catalina" as the main class, "start" as program arguments, and "-Dcatalina.home=..."進入“為主要類org.apache.catalina.startup.Catalina”,“啟動”的程序參數,和“- Dcatalina.home =..." (with the name of your build directory) as VM arguments. (與您的構建目錄名稱)VM參數。
Note also that due to the way the Tomcat source is assembled from several SVN projects, you may not be able to use the Eclipse SVN client to update (nor to commit, if you are a committer).另請注意,由于Tomcat的來源是從幾個SVN項目的組裝方式,您可能無法使用Eclipse SVN客戶端更新(或承諾,如果您是提交者)。 Use the external SVN client of your choice, then use the Eclipse PackageExplorer or Navigator "Refresh" context menu item to tell Eclipse that you've updated the files.使用您所選擇的外部SVN客戶端,然后使用Eclipse PackageExplorer或導航器“刷新”上下文菜單項來告訴Eclipse您已更新的文件。
網頁標題:java代碼英語翻譯 java代碼翻譯工具
當前網址:http://www.2m8n56k.cn/article8/doidhop.html
成都網站建設公司_創新互聯,為您提供網頁設計公司、關鍵詞優化、App開發、網站策劃、動態網站、外貿建站
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯