以下语句的Java等效指令是什么:
String name;
cout << "So your name is " << name << endl;
或者在C#中
console.writeline("So your name is {0} ", name);
答案 0 :(得分:5)
String name;
cout<<"So your name is "<<name<<endl;
相当于:
String name = ...;
System.out.println("So your name is " + name);
和
Console.WriteLine("So your name is {0}", name);
相当于:
System.out.printf("So your name is %s", name);