C # variables

 

% Name can not appear symbol

 

 

 

 
 
. 1  the using the System;
 2  the using the System.Collections.Generic;
 . 3  the using the System.Linq;
 . 4  the using the System.Text;
 . 5  the using System.Threading.Tasks;
 . 6  
. 7  namespace ConsoleApplication3
 . 8  {
 . 9      class Program
 10      {
 . 11          String STR = "" ; // instance variables only make calls using the name of the object 
12          static  String str2 = " dsFv " ; // static member variables can directly call the 
13          static void Main(string[] args)
14         {
15             Program p = new Program();//使用对象名才可以进行调用
16             Console.WriteLine(p.str);
17             Console.WriteLine(str2);
18             int money = 300;
19             int money2;
20             money2 = 200;
21             int money3, moner4;
22             string title="dsfsgfdgd";
23             string title1;
24             title1 =title ;
25             string s1, s2, s3;
26             s1 = s2 = s3 = "";
27             Console.WriteLine(title);
28             Console.WriteLine(title1);
29             Console.Read();
30           
31 
32         }
33         void showInfo()
34         {
35             string str3 = "";//str3为局部变量不能再class中调用
36             Console.WriteLine(str3);
37             Console.WriteLine(str);
38         }
39     }
40 }

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/ZHANG576433951/p/11128901.html