Program:P1:/*here is very simple program in c#*/
class SimpleProg
{
public static void Main()
{
System.Console.WriteLine("Simple program in c#");
}
}
SO,
C# is an object oriented language therefore everything must be placed inside a class.
Its a block-structured language so,code blocks are alwys enclosed in braces { & }.
Here in c# the M of Main keyword should be capital,Public is an access modifier and static declares that Main method is a global and can be called without creating an instance of the class.
The out put line:
System.Console.WriteLine("Simple program in c#");
where WriteLine is a static method of the Console class,which is located in the namespace System.Also every C# statement must end with a semicolon(;).
And // used for single line commants where /*........*/ used for multiline commants.
No comments:
Post a Comment