十个人有九个做错的面试题
2010-12-14 21:07
253 查看
今天一个朋友发来他们公司的面试题,是他出的;让我做做,结果呢,太粗心我也只答对了一半,不信你也来试试!
先说好,不要把代码弄到VS里面运行,你直接给出答案看能做对不!好了,直接上代码。
1 class Program
2 {
3 static void Main(string[] args)
4 {
5 int x = 1;
6 int y = 2;
7 MyClass test1 = new MyClass(x, y);
8 test1.Print();
9 x = 3;
y = 4;
MyClass test2 = new MyClass(x, y);
test2.Print();
}
}
class MyClass
{
private int x;
private int y;
public MyClass()
{
}
public MyClass(int x, int y)
{
x = x;
y = y;
}
public void Print()
{
Console.WriteLine(string.Format("X is: {0} Y is: {1}", x, y));
}
}这个题很麻人,但也考察了面试者的基本功哦^_^
先说好,不要把代码弄到VS里面运行,你直接给出答案看能做对不!好了,直接上代码。
1 class Program
2 {
3 static void Main(string[] args)
4 {
5 int x = 1;
6 int y = 2;
7 MyClass test1 = new MyClass(x, y);
8 test1.Print();
9 x = 3;
y = 4;
MyClass test2 = new MyClass(x, y);
test2.Print();
}
}
class MyClass
{
private int x;
private int y;
public MyClass()
{
}
public MyClass(int x, int y)
{
x = x;
y = y;
}
public void Print()
{
Console.WriteLine(string.Format("X is: {0} Y is: {1}", x, y));
}
}这个题很麻人,但也考察了面试者的基本功哦^_^
相关文章推荐
- C#.net面试题,提醒自己下次别再做错了!
- 大部分人都会做错的经典JS闭包面试题
- 十个人九个答不出来……
- 大部分人都会做错的经典JS闭包面试题
- 据说有99%的人都会做错的面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 据说有99%的人都会做错的面试题
- 一个据说第一次接触都会做错的Java面试题和类加载器的介绍
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题
- 创业公司和求职者都应看的九个面试题
- 大部分人都会做错的经典JS闭包面试题
- 大部分人都会做错的经典JS闭包面试题