Java:
In java if you don't wanna create an instance of a class. Simply put a private constructor in that class.
C#
In C# also u can follow the same approach but the .net platform provides a simple feature called static class.Look at the following code:
static class MyClass
{
static void hello()
{
Console.WriteLine("Hello World");
}
}
This class can only contain static data.
Note: You can't find static classes in java
September 21, 2008
static in java and c#
9/21/2008 02:46:00 PM Posted by kalyan kumar B
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment