日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java string查找_查找输出程序(Java String类)

發布時間:2025/3/11 java 14 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java string查找_查找输出程序(Java String类) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

java string查找

Program 1

程序1

public class iHelp {public static void main (String[] args){System.out.println("Google".charAt(3));} }

Output

輸出量

g

Explanation

說明

String.charAt() is a library function of String class, it returns character from given index of the string. Here, in the statement "Google".charAt(3) will return 'g', because 'g' exists on the 3rd index.

String.charAt()是String類的庫函數,它從字符串的給定索引返回字符。 此處,在語句“ Google”中,charAt(3)將返回'g' ,因為'g'存在于第三個索引上。



Program 2

程序2

public class iHelp {public static void main (String[] args){System.out.println("Google"+3);} }

Output

輸出量

Google3

Explanation

說明

In java String, "+" is a concatenation operator, if we concatenate any number or string with the string, it returns that number/string concatenated to the string.

在java字符串中, “ +”是連接運算符,如果我們將任何數字或字符串與字符串連接,它將返回連接到該字符串的數字/字符串。

Here, "Google" is a string and 3 is a number. The resultant string of "Google"+3 will be "Google3".

在這里, “ Google”是一個字符串,而3是一個數字。 結果字符串“ Google” +3將為“ Google3” 。



Program 3

程序3

public class iHelp {public static void main (String[] args){System.out.println(10+20);} }

Output

輸出量

30

Explanation

說明

10+20 is a simple numeric expression, addition will be performed. Therefore, the result will be 30.

10 + 20是一個簡單的數字表達式,將執行加法運算。 因此,結果將是30 。



.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}

Program 4

程序4

public class iHelp {public static void main (String[] args){if(System.out.println(10) == System.out.println(10))System.out.println("TRUE");elseSystem.out.println("FALSE");} }

Output

輸出量

Compilation error:

編譯錯誤:

Main.java:6: error: 'void' type not allowed hereif(System.out.println(10) == System.out.println(10))^1 error

Explanation

說明

The statement System.out.println() does not return anything. Therefore, no value will be for compression. Error will be "void" type not allowed here.

語句System.out.println()不返回任何內容。 因此,沒有任何壓縮值。 錯誤將是此處不允許的“ void”類型 。



Program 5

程序5

public class iHelp {public static void main (String[] args){System.out.println(10+20+""+40);} }

Output

輸出量

3040

Explanation

說明

10+20 will be added first, and result of 10+20 will be 30. Then, " " will be concatenated to the 30, so it will become "30" in string. After that, "30"+40 will be "3040" (because if any string/number is added to the string it will concatenate as string).

10 + 20將被首先添加,以及10 + 20的結果將是30。然后,“”將被級聯到30,所以它會成為“字符串30”。 此后, “ 30” +40將為“ 3040” (因為如果在字符串中添加了任何字符串/數字,它將串聯為字符串)。

Therefore, output will be "3040".

因此,輸出將為“ 3040” 。



翻譯自: https://www.includehelp.com/java/find-output-programs-java-string-class.aspx

java string查找

總結

以上是生活随笔為你收集整理的java string查找_查找输出程序(Java String类)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。