Program.cs文件:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace Test1
{
class Program
{
static void Main(string[] args)
{
///*
//1.强制类型转换
//装箱:值类型转换成引用类型
//拆箱:引用类型转换成值类型
//*/
//int a1 = 10;
//object o2 = 15;
//object a4 = 3.141592653;
//object o1 = a1;//值类型转换成引用类型(隐式转换)
//int a2 = (int)o2;//引用类型转换成值类型
//int a3 = Convert.ToInt32(o2);//强制转换成整型
//float a6 = Convert.ToSingle(a4);//强制转换成单精度浮点型
//double a7 = (double)a4;
//double a8 = Convert.ToDouble(a4);强制转换成双精度浮点型
///*
//2. 基本数据
// break跳出整个循环
// continue结束本次循环
//*/
////字符串
//string s1 = "hello 哈喽 \'我爱你\"";
//Console.WriteLine(s1);
////const常量
//const int c1 = 2;
////bool
//bool b1 = (12 + 13) * 2 >= 27;
////输入
//string s2 = Console.ReadLine();
//Console.WriteLine(s2);
////等待用户输入,避免屏幕一闪而过
//Console.ReadKey();
////数组
//int[] arry1 = new int[3] {0,1,2};
//int[] arry2 = new int[arry1.Length];
//int[] arr0 = {12,6,9,3,8,7 };
//int tmp = 0;
/*
3.数组、冒泡排序
*/
//int[] arr0 = {12,6,9,3,8,7};
//int tmp = 0;
////1.比较array0.Length-1趟
//for (int i=1;i<= arr0.Length-1;i++) {
// //2.每趟中比较array0.Length- i次
// for (int j =1; j<= arr0.Length - i;j++) {
// if (arr0[j-1]> arr0[j]) {
// //前者比后者大:交换
// tmp = arr0[j - 1];
// arr0[j - 1] = arr0[j];
// arr0[j] = tmp;
// }
// }
//}
//for (int p=0;p< arr0.Length;p++) {
// // Console.WriteLine(arr0[p]);
//}
/*
4.日期操作
*/
DateTime dTime = DateTime.Now.AddDays(-1);
string strTime = dTime.ToString("yyyy-MM-dd HH:mm:ss");
Console.WriteLine(strTime);
/*
5.异常处理跟Java相同
*/
}
}
}