99偷拍视频精品区一区二,口述久久久久久久久久久久,国产精品夫妇激情啪发布,成人永久免费网站在线观看,国产精品高清免费在线,青青草在线观看视频观看,久久久久久国产一区,天天婷婷久久18禁,日韩动漫av在线播放直播

java新手代碼大全翻譯 java新手代碼大全翻譯中文

給段最簡單的java代碼 讓我新手看一下

最簡單的java代碼肯定就是這個了,如下:

創新互聯從2013年創立,先為木蘭等服務建站,木蘭等地企業,進行企業商務咨詢服務。為木蘭企業網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。

public class MyFirstApp

{

public static void main(String[] args)

{

System.out.print("Hello world");

}

}

“hello world”就是應該是所有學java的新手看的第一個代碼了。如果是零基礎的新手朋友們可以來我們的java實驗班試聽,有免費的試聽課程幫助學習java必備基礎知識,有助教老師為零基礎的人提供個人學習方案,學習完成后有考評團進行專業測試,幫助測評學員是否適合繼續學習java,15天內免費幫助來報名體驗實驗班的新手快速入門java,更好的學習java!

Java 代碼翻譯

package?com.lp.test;

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.

public?class?BankAccount?{

private?static?String?acctnum;

private?static?double?money;

private?static?void?showAcct()?{

System.out.println("賬號為:?"?+?acctnum);

}

private?static?void?showMoney()?{

System.out.println("余額為:?"?+?money);

}

public?BankAccount(String?acc,?double?m)?{

this.acctnum?=?acc;

this.money?=?m;

}

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

BankAccount?ba?=?new?BankAccount("626600018888",?5000.00);

ba.showAcct();

ba.showMoney();

}

}

//2.

public?class?Triangle?{

private?static?float?a;

private?static?float?b;

private?static?float?c;

public?Triangle(float?a,?float?b,?float?c)?{

this.a?=?a;

this.b?=?b;

this.c?=?c;

}

public?static?boolean?judgeTriangle(float?a,?float?b,?float?c)?{

if?((a??Math.abs(b?-?c)??a??b?+?c)

?(b??Math.abs(a?-?c)??b??a?+?c)

?(c??Math.abs(a?-?b)??c??a?+?b))

return?true;

else

return?false;

}

public?float?getCircumference()?{

return?this.a?+?this.b?+?this.c;

}

}

//3.

public?class?TestTriangle?{

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

Triangle?t?=?new?Triangle(5.3f,7.8f,9.3f);

if(t.judgeTriangle(5.3f,7.8f,9.3f)){

System.out.print("能夠成三角形,周長為:?");

System.out.printf("%9.2f",t.getCircumference());}

else

System.out.println("不能構成三角形");

}

}

求翻譯解釋一下Java代碼

public?class?Test{

public?static?String?output="?";

public?static?void?foo(int?i){

try{

if(i==1){

throw?new?Exception();//如果參數為1,拋出異常,進入到catch

}

output+="1";

}catch(Exception?e){

output+="2";//如果參數為1,執行這里

return;

}finally{

output+="3";//不管怎樣這里都要執行

}

output+="4";//這里是最后一個執行語句,拋出異常就不執行這里

}

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

foo(0);//第一次調用

foo(1);//第二次調用

System.out.println(Test.output);

}

}

/*

*?現在說下執行步驟:output的值我[]括起來

*?第一次調用foo(0):(1)參數為0,所以執行output+="1",那么output現在為[?1];

*? ????(2)執行到output+="3",那么output現在為[?13];

*? ????(3)執行到output+="4";那么output現在為[?134]

*?第二次調用foo(1):(1)執行if里面,拋出異常

*? ????(2)進入到catch,執行output+="2",output現在為[?1342]

*? ????(3)進入finally,執行output+="3", output現在為[?13423]

*/

分享名稱:java新手代碼大全翻譯 java新手代碼大全翻譯中文
網頁地址:http://www.yijiale78.com/article22/hpdcjc.html

成都網站建設公司_創新互聯,為您提供自適應網站網站營銷建站公司網站收錄網站改版網頁設計公司

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

微信小程序開發