Adobe Interview Question for Computer Scientists


Team: PSE
Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
2
of 2 vote

use enum...

- sujita July 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

this is the best and clean way

- Rajesh September 01, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Java Perspective: Number of ways:
you can use synchronization - actually that is the first thing that should come to mind whenever encountering questions involving multithreaded environment plus single access.
The thing is, synchronization is needed only once since it is expensive in its nature.

- ethioer July 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

you can make the getInstance() method ( or whatever method name you are using to return the object reference) as synchronized.

- Anonymous July 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

initialize object statically.static initailization is taken care by JVM..

- Amith manepu July 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Google double locking synchronization

- Venkat July 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

check out Question 15 here : javabeat.net/2009/02/design-patterns-interview-questions/

- amit August 05, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use SingletonHandler approach for lazily loading singleton instance.

public class Singleton {

	private Singleton() {
		
	}
	
	public static class SingletonHolder {
		public static final Singleton INSTANCE = new Singleton();
	}
}

- a.b August 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

See this example:

public class Singleton
{
private Singleton instance;
private Singleton(){}

public Singleton getInstance()
{
if(instance==null)
{
synchronized(Singleton.this)
{
instance = new Singleton();
}
}
return instance;
}
}

- Prashant August 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

The synchronized block makes no sense here. If two threads manage to enter the if-block together, they will anyway create two instances of singleton class. We need to sync the if-block, not just the line where object is instantiated.

- jatin085 September 05, 2012 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More