VMWare Inc Interview Question for Quality Assurance Engineers


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




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

It will belong to a particular interface based on its child class runtime polymorphism.
If the object instance is created using

IA ia = new TestUtils();
ia.print();

Then its belongs to A interface.

//IA.java

public interface IA {
public void print();
}


//IB.java

public interface IB {
public void print();
}

//TestUtils.java

public class TestUtils implements IA, IB {

@Override
public void print() {
System.out.println("print");
}

public static void main(String[] args) {
IA ia = new TestUtils();
IB ib = new TestUtils();
ia.print();// IA'a print method
ib.print();// IB's print method
}
}

- Vinod Sreepathi August 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Well actually, it would be of both.

As long as they have the same signatures the compiler will consider them as one method. In case that one of them has a different return type it would result in compile error.

- srdjan August 06, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for example
public interface A {

public void show();
}

public interface B {

public void show();
}

public class Test implements A, B {

public static void main(String[] args) {

A a;
B b;
Test t = new Test();
a = t;
a.show();
b = t;
b.show();

}

@Override
public void show() {
System.out.println("this method is from class Test:");
System.out.println(this.getClass().getInterfaces()[0]);
System.out.println(this.getClass().getInterfaces()[1]);

}

}

op:-
this method is from class Test:
interface A
interface B
this method is from class Test:
interface A
interface B

- nagarjuna.lingala August 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Like virtual method in c++, for multiple inheritance for child class only one method will be appear. same thing is used by compiler here also without using any virtual keyword.
so for class A only one method has to be implemented.

- Anonymous August 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

No . problem it works fine when you override its method but when signature of any methods differ then compile time error

- Alok Pandey August 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It depends on the method on interface B and C. If interface B and C have the same exact method, then it would not be distinguishable. However, if the method for interface B and C is like this,

void someMethod(some parameter)
boolean someMethod(some parameter)

Then it depends what method class A is specifically looking for.

- tipper truong February 16, 2016 | Flag Reply


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