java中为按钮添加图片_如何在Java中为字符串添加双引号?
java中為按鈕添加圖片
In Java, everything written in double-quotes is considered a string and the text written in double-quotes is display as it is.
在Java中, 雙引號中的所有內容均視為字符串,而雙引號中的文本按原樣顯示。
Suppose, if we want to add double quotes to a string then we need [\"] escape sequence to escape quotes.
假設,如果要在字符串中添加雙引號,則需要[ \“ ]轉義序列來轉義引號。
Let us suppose if we have a string "Preeti" and simply it will display like this preeti and if we want to add double quotes to string (i.e. display like "preeti" ) then we will write a statement like this "\"Preeti\"".
讓我們假設,如果我們有一個字符串“ Preeti”,并且簡單地將顯示為這樣的preeti,并且如果我們想在字符串中添加雙引號(例如,顯示為“ preeti” ),那么我們將編寫一個這樣的語句: “ \” Preeti \ ” 。
We will understand this thing with the help of an Example...
我們將借助“示例”來理解這件事。
Example:
例:
public class AddQuotesToString {public static void main(String[] args) {// Create a string named str1 with value Java // and display like this Java.String str1 = "Java";// Create a string named str2 with value OOPS // and display like this Java "OOPS".// For adding double quotes to OOPS // then we need or add \" escape sequence to escape quotes // around both side string.String str2 = " \" OOPS \" ";System.out.println("Display String without quotes " + " " + str1);System.out.println("Display String with quotes " + " " + str2);} }Output
輸出量
D:\Programs>javac AddQuotesToString.javaD:\Programs>java AddQuotesToString Display String without quotes Java Display String with quotes " OOPS "翻譯自: https://www.includehelp.com/java/how-to-add-double-quotes-to-a-string-in-java.aspx
java中為按鈕添加圖片
總結
以上是生活随笔為你收集整理的java中为按钮添加图片_如何在Java中为字符串添加双引号?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java nextlong_Java R
- 下一篇: Java LocalDate类| 带示例