Click here to Skip to main content
Click here to Skip to main content

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

, 30 Sep 2001
Rate this:
Please Sign up or sign in to vote.
Writing hello world program using different approaches in C#.

Hello World Smile | :)

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

/* 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

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

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

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 PinmemberPavan Gayakwad11-Jul-06 2:28 
GeneralThank you. LOW COST DEVELOPMENT IN INDIA. http://www.xtremeheights.com Pinmembernemesh4-Nov-04 20:04 
Generalusing System; PinmemberKatsarakis23-Oct-01 9:23 
Generalgood work again.... PinmemberNish [BusterBoy]11-Oct-01 18:13 
GeneralYou are good writer PinmemberAmita Butch2-Oct-01 6:40 
GeneralUseful for beginners PinmemberFrog1-Oct-01 23:34 
GeneralRe: Useful for beginners PinmemberNemesh Singh2-Oct-01 2:05 
GeneralRe: Useful for beginners PinmemberMarijn Stevens14-Nov-06 6:53 
GeneralRe: Useful for beginners Pinmemberyuronline15-Aug-07 11:22 
GeneralRe: Useful for beginners PinmemberMarijn Stevens15-Aug-07 14:14 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 1 Oct 2001
Article Copyright 2001 by nemesh
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid