占位符,表示这里是第0个用户要放入内容的地方。
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1_StudyFromBook
{
class Program
{
static void Main(string[] args)
{
int a = 927;
byte b = 255;
Console.WriteLine("a={0},b={1}", a, b);
Console.ReadLine();
}
}
}
结果:
2.不正确的代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1_StudyFromBook
{
class Program
{
static void Main(string[] args)
{
int a = 927;
byte b = 255;
Console.WriteLine("a=", a);
Console.WriteLine("b=", b);
Console.ReadLine();
}
}
}
运行结果如下:
没有显示数值。