一.echo命令 #1.直接显示字符串 echo "It is a test" #输出:It is a test #2.显示转义字符 echo "\"It is a test\"" #输出:"It is a test" #3.显示变量 name=Shell echo "$name It is a test" #输出:Shell is a test #4.显示换行 echo -e "OK! \n&q
有时候在一个方法中,我们需要返回多个字符串,而又不想将这些字段包成一个类.此时就需要使用输出型参数. 但是如果将输出型参数的类型声明为String,那么调用该方法后,是获取不到我们想要的值的. 测试代码如下: public class StringTest { public static void main(String[] args){ StringTest st = new StringTest(); String a = "a"; String b = "b"