In Java programming, we often use System.out.println(); to output strings.
System.out.println();
System is a class, inherited from the root class Object
out is an object instantiated by the PrintStream class. And it is a static member variable of the System class
println() is a member method of the class PrintStream and is called by the object out
package Number; public class Frust { //声明 静态的 字符串变量 ,不大明白 静态是啥意思 static String s1 = "你好"; public static void main(String[] args) { // TODO 自动生成的方法存根 //声音一个 字符串变量 String s2 = "Java"; //输出 S1 + S2 字符串 System.out.println(s1 + s2); //输出 S1 字符串 System.out.println(s1 ); //输出 S2 字符串 System.out.println(s2); } }
For more java knowledge, please pay attentionjava basic tutorial Column.
The above is the detailed content of How to output java string. For more information, please follow other related articles on the PHP Chinese website!