TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
328.6k
method
Dec 4 2011 4:27 PM
In this program there is no call for test() method. Under these circumstances how it can output message (Using static constructor to initialize static data members ) in its content.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace static_eg
{
class Program
{
public class test
{
static string name;
static int age;
static test()
{
Console.WriteLine("Using static constructor to initialize static data members");
name = "John Sena";
age = 23;
}
public static void display()
{
Console.WriteLine("Using static function");
Console.WriteLine(name);
Console.WriteLine(age);
}
}
static void Main(string[] args)
{
test.display();
Console.ReadLine();
}
}
}
/*
Using static constructor to initialize static data members
Using static function
John Sena
23
*/
Reply
Answers (
2
)
Namespace
Game development - Data question