赴微软开发测试工程师的面试低级错误是不是就给自己判了死刑?

huoxudong125 2008-03-11 10:00:36
如题,在微软面试这一关中我犯了个低级错误:
...
boolean flag;
if(!flag)
{
return new B();
flag=true;
}


...
当时真是蒙了,紧张的只记得是讲这个单例设计模式的目的,和简单原理 。
却忘了这个低级错误,

其他问题,答的还行,(本人毕业半年)
就是这里糊涂了,当时怎么就没看出来,平时在机器上的话会提示:有无法访问的语句,
也就知道错误了,这下可好,当时蒙的连这点都没看出来,
唉,正不知微软面试我的那位会怎么看待我的这个错误
...全文
314 28 打赏 收藏 转发到动态 举报
写回复
用AI写文章
28 条回复
切换为时间正序
请发表友善的回复…
发表回复
huoxudong125 2009-09-01
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 winner2050 的回复:]
引用楼主 huoxudong125 的帖子:
如题,在微软面试这一关中我犯了个低级错误:
...
boolean flag;
if(!flag)
{
return new B();
flag=true;}


...
当时真是蒙了,紧张的只记得是讲这个单例设计模式的目的,和简单原理 。
却忘了这个低级错误,

其他问题,答的还行,(本人毕业半年)
就是这里糊涂了,当时怎么就没看出来,平时在机器上的话会提示:有无法访问的语句,
也就知道错误了,这下可好,当时蒙的连这点都没看出来,
唉,…


-_-!!

能编译??
[/Quote]
黑板上写的
huoxudong125 2008-03-11
  • 打赏
  • 举报
回复
谢谢大家的关注回复,
huoxudong125 2008-03-11
  • 打赏
  • 举报
回复
恩,就是颠倒了!

希望大家不要像我,祝大家工作顺利!
lextm 2008-03-11
  • 打赏
  • 举报
回复
条条大路通罗马。不见得一定要进微软才能体现LZ的价值。
laznhr 2008-03-11
  • 打赏
  • 举报
回复
什么错误?是把两行的次序换错了?
大宇_ 2008-03-11
  • 打赏
  • 举报
回复
别担心,是金子在那都会发光,下次注意就好了
cpw999cn 2008-03-11
  • 打赏
  • 举报
回复
这种错误的话。。比较难以原谅啊。。
随风醉舞 2008-03-11
  • 打赏
  • 举报
回复
下次注意就好~~
winner2050 2008-03-11
  • 打赏
  • 举报
回复
[Quote=引用楼主 huoxudong125 的帖子:]
如题,在微软面试这一关中我犯了个低级错误:
...
boolean flag;
if(!flag)
{
return new B();
flag=true;}


...
当时真是蒙了,紧张的只记得是讲这个单例设计模式的目的,和简单原理 。
却忘了这个低级错误,

其他问题,答的还行,(本人毕业半年)
就是这里糊涂了,当时怎么就没看出来,平时在机器上的话会提示:有无法访问的语句,
也就知道错误了,这下可好,当时蒙的连这点都没看出来,
唉,…
[/Quote]

-_-!!

能编译??
随风醉舞 2008-03-11
  • 打赏
  • 举报
回复
谁都有犯低级错误的时候~~
viena 2008-03-11
  • 打赏
  • 举报
回复
new B
随风醉舞 2008-03-11
  • 打赏
  • 举报
回复
其他的答的不错可以了~~
随风醉舞 2008-03-11
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 Plife472 的回复:]
楼主太紧张了
[/Quote]
zhao_xiaozi 2008-03-11
  • 打赏
  • 举报
回复
是比较低级. 以后注意就行了.
Plife472 2008-03-11
  • 打赏
  • 举报
回复
楼主太紧张了
mikebai 2008-03-11
  • 打赏
  • 举报
回复
......
kwmtnk 2008-03-11
  • 打赏
  • 举报
回复
up
  • 打赏
  • 举报
回复
- -LZ真有才。。
  • 打赏
  • 举报
回复
- -

huoxudong125 2008-03-11
  • 打赏
  • 举报
回复
// Singleton实例代码

// Intent: "Ensure a class only has one instance, and provide a global
// point of access to it".

// For further information, read "Design Patterns", p127, Gamma et al.,
// Addison-Wesley, ISBN:0-201-63361-2

/* Notes:
* If it makes sense to have only a single instance of a class (a so-called
* singleton), then it makes sense to enforce this (to elimintate potential
* errors, etc).
*
* A class based on the singleton design pattern protects its constructor,
* so that only the class itself (e.g. in a static method) may instantiate itself.
* It exposes an Instance method which allows client code to retrieve the
* current instance, and if it does not exist to instantiate it.
*/

namespace Singleton_DesignPattern
{
using System;

class Singleton
{
private static Singleton _instance;

public static Singleton Instance()
{
if (_instance == null)
_instance = new Singleton();
return _instance;
}
protected Singleton(){}

// Just to prove only a single instance exists
private int x = 0;
public void SetX(int newVal) {x = newVal;}
public int GetX(){return x;}
}

/// <summary>
/// Summary description for Client.
/// </summary>
public class Client
{
public static int Main(string[] args)
{
int val;
// can't call new, because constructor is protected
Singleton FirstSingleton = Singleton.Instance();
Singleton SecondSingleton = Singleton.Instance();

// Now we have two variables, but both should refer to the same object
// Let's prove this, by setting a value using one variable, and
// (hopefully!) retrieving the same value using the second variable
FirstSingleton.SetX(4);
Console.WriteLine("Using first variable for singleton, set x to 4");

val = SecondSingleton.GetX();
Console.WriteLine("Using second variable for singleton, value retrieved = {0}", val);
return 0;
}
}
}
加载更多回复(8)

7,765

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧