Click here to Skip to main content
15,892,298 members
Articles / Programming Languages / C#
Article

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 71.3K   11   10
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


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralExample 5 Pin
Pavan Gayakwad11-Jul-06 1:28
Pavan Gayakwad11-Jul-06 1:28 
GeneralThank you. LOW COST DEVELOPMENT IN INDIA. http://www.xtremeheights.com Pin
nemesh4-Nov-04 19:04
nemesh4-Nov-04 19:04 
Generalusing System; Pin
Katsarakis23-Oct-01 8:23
Katsarakis23-Oct-01 8:23 
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
Frog1-Oct-01 22:34 
GeneralRe: Useful for beginners Pin
2-Oct-01 1:05
suss2-Oct-01 1:05 
Hi Frog,
Thank You for ur suggestion. It was indeed a compliment for me. I have just started to write the articles on codeproject.com and so targeting beginners and soon I would upload some articles for intermidiate and advanced users also. I am first writing for beginners so that if a beginner reads all of my articles he could understand the very basic and fundamental expect of C# programming. Then I would take him to more complex topics.
And according to me a Beginner needs more articles compared to advanced users as he has to clear his basics and doubts and advanced users know the logics and can think more rapidly than beginners.
Blush | :O Blush | :O Blush | :O
GeneralRe: Useful for beginners Pin
User 226147414-Nov-06 5:53
User 226147414-Nov-06 5:53 
GeneralRe: Useful for beginners Pin
yuronline15-Aug-07 10:22
yuronline15-Aug-07 10:22 
GeneralRe: Useful for beginners Pin
User 226147415-Aug-07 13:14
User 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.