Click here to Skip to main content
15,029,296 members
Articles / Programming Languages / C#
Article
Posted 30 Sep 2001

Stats

69.4K views
11 bookmarked

Traditional "Hello World" Programme Using Different Approaches. PART-II.

Rate me:
Please Sign up or sign in to vote.
4.40/5 (5 votes)
30 Sep 2001
Writing hello world program using different approaches in C#.

Hello World :)

In Part - I, I tried to explain the very basic "HELLO WORLD" program. In this article, I would use different methods to display "HELLO WORLD" so as to clear some of the OOPS fundamentals. So, without wasting much time, let's go on with it.

EXAMPLE: 1

C#
/* In this Programme you must have noticed
 that there is no base class declaration 
 here but to call WriteLine Method, Base class
  i.e System is appended before Console.*/ 


public class nemesh
{ 
    public static void Main()
     {
       System.Console.WriteLine("HELLO WORLD");
     }
}

EXAMPLE: 2

C#
using system;
public class nemeshc      /* class declared as 'nemeshc' */
{ 
   public void nemeshm()     /* 'method declared as 'nemeshm' */
     {
       Console.WriteLine("HELLO WORLD");
     }

    public static void Main()     /* Main Entry Point */
    {
   /* Object of class 'nemeshc' is constructed */
      nemeshc nem = new nemeshc();
   /* method 'nemeshm' of class 'nemeshc' is called*/
      nem.nemeshm();
    }
}

EXAMPLE: 3

C#
using system;
public class nemeshc      /* class declared as 'nemeshc' */
{
  /* 'nemeshc' constructor is created and it fires when
     the object of the class 'nemeshc' is constructed */ 
   public nemeshc()     
     {
       Console.WriteLine("HELLO WORLD");
     }

    public static void Main()     /* Main Entry Point */
    {
   /* Object of class 'nemeshc' is constructed */
      nemeshc nem = new nemeshc();
    }
}

EXAMPLE: 4

C#
using system;
public class nemeshc      /* class declared as 'nemeshc' */
{ 
    public static void Main()     /* Main Entry Point */
    {
   /* Object of class 'nemesh1c' is constructed */
      nemesh1c nem = new nemesh1c();
   /* Method "neme1" of class 'nemesh1c' is called*/
      nem.neme1();
    }
} 

public class nemesh1c      /* class declared as 'nemesh1c' */
{ 
    public void neme1()     /* Method declared as 'neme1' */
    {
      Console.WriteLine("Hello World");     
    }
}

So folks! How was it? Did you get the things or all went above your head? If you are not able to understand any thing, then please mail me or just create a new thread and leave a message. I would try to explain it more deeply.

In my next article, I would explain to you "The beauty of .NET platform using C# and VB.NET".

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

nemesh
Web Developer
India India
No Biography provided

Comments and Discussions

 
GeneralExample 5 Pin
Pavan Gayakwad11-Jul-06 1:28
MemberPavan Gayakwad11-Jul-06 1:28 
GeneralThank you. LOW COST DEVELOPMENT IN INDIA. http://www.xtremeheights.com Pin
nemesh4-Nov-04 19:04
Membernemesh4-Nov-04 19:04 
Generalusing System; Pin
Katsarakis23-Oct-01 8:23
MemberKatsarakis23-Oct-01 8:23 
Good work! System is a case sensitive word. Cool | :cool:
Generalgood work again.... Pin
Nish Nishant11-Oct-01 17:13
sitebuilderNish Nishant11-Oct-01 17:13 
GeneralYou are good writer Pin
2-Oct-01 5:40
suss2-Oct-01 5:40 
GeneralUseful for beginners Pin
Frog1-Oct-01 22:34
MemberFrog1-Oct-01 22:34 
GeneralRe: Useful for beginners Pin
2-Oct-01 1:05
suss2-Oct-01 1:05 
GeneralRe: Useful for beginners Pin
User 226147414-Nov-06 5:53
MemberUser 226147414-Nov-06 5:53 
GeneralRe: Useful for beginners Pin
yuronline15-Aug-07 10:22
Memberyuronline15-Aug-07 10:22 
GeneralRe: Useful for beginners Pin
User 226147415-Aug-07 13:14
MemberUser 226147415-Aug-07 13:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.