Click here to Skip to main content
Licence 
First Posted 30 Sep 2001
Views 60,396
Bookmarked 11 times

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

By | 30 Sep 2001 | Article
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

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

About the Author

nemesh

Web Developer

India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralExample 5 PinmemberPavan Gayakwad1:28 11 Jul '06  
GeneralThank you. LOW COST DEVELOPMENT IN INDIA. http://www.xtremeheights.com Pinmembernemesh19:04 4 Nov '04  
Generalusing System; PinmemberKatsarakis8:23 23 Oct '01  
Generalgood work again.... PinmemberNish [BusterBoy]17:13 11 Oct '01  
GeneralYou are good writer PinmemberAmita Butch5:40 2 Oct '01  
GeneralUseful for beginners PinmemberFrog22:34 1 Oct '01  
GeneralRe: Useful for beginners PinmemberNemesh Singh1:05 2 Oct '01  
GeneralRe: Useful for beginners PinmemberMarijn Stevens5:53 14 Nov '06  
GeneralRe: Useful for beginners Pinmemberyuronline10:22 15 Aug '07  
GeneralRe: Useful for beginners PinmemberMarijn Stevens13:14 15 Aug '07  

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.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 1 Oct 2001
Article Copyright 2001 by nemesh
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid