using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ConsoleApp1
{class Program{static void Main(string[] args){/****值类型****/bool test;//必须赋值,否则报错test = true;Console.WriteLine(test.ToString());//输出的是True;Boolean test2;//必须赋值,否则报错test2 = false;Console.WriteLine(test2.ToString());//输出的False;int num1;//必须赋值,否则报错num1 = 2;Console.WriteLine(num1.ToString());float num2;num2 = 3.433F;//不赋值报错,不加F报错Console.WriteLine(num2.ToString());double num3;num3 = 3.43;//必须赋值,否则报错Console.WriteLine(num3.ToString());decimal num4;num4 = 4.3M;//不赋值报错,不加M报错Console.WriteLine(num4.ToString());/****引用类型****/string a;a = null;string b = a;a = "3";Console.WriteLine(a);//输出3Console.WriteLine(b);//输出空字符String str1 = "abc";String str2 = str1;str1 = "change";Console.WriteLine(str1);Console.WriteLine(str2);Person p1 = new Person();Person p2 = p1;p1.Name = "p1";Console.WriteLine(p2.Name);//输出p1p2.Name = "p2";Console.WriteLine(p1.Name);//输出p2Console.WriteLine(p2.Name);//输出p2}}
}