這是我創建的一個簡單程序 - 一個表類,一個主類。在表格類中,我創建了一個簡單輸出我的名字的打印方法。從主類我打電話打印方法,但沒有得到輸出。錯誤 - 程序在調用打印方法時未給出輸出
namespace ConsoleApplication3
{
class table
{
public static void print()
{
Console.WriteLine("My name is prithvi-raj chouhan");
}
}
class Program
{
public static void Main()
{
table t = new table();
t.print(); // Error the program is not giving output while calling the print method
}
}
}
謝謝。你可以解釋一下靜態和實例方法之間的一點點。如果我是對的,這兩個用於方法。預先感謝 – Geek 2012-08-14 11:47:05
你可以看看這裏http://msdn.microsoft.com/en-us/library/79b3xss3 (v = vs.80).aspx,它有很多東西供你學習。 – perilbrain 2012-08-14 11:49:13
謝謝,真的有幫助:) – Geek 2012-08-14 11:57:35