Developer Interview Questions

270,956 developer interview questions shared by candidates

What is the output of the following program? class Poly { static int length; int width; public Poly(int l, int w) { length = l; width = w; } int area() { return 2*length*width; } } class Rect extends Poly { public Rect(int l, int w) { super(l,w); } int area() { return length*width; } } class Solution { public static void main(String args[]) { Poly rect1 = new Poly(5,5); Poly rect2 = new Rect(6,4); int area1 = rect1.area(); int area2 = rect2.area(); System.out.println(area1 + " " + area2); } } 30 24 60 48 60 24 25 24 50 48 48 24 50 24
avatar

Android Developer

Interviewed at Smartprix

3.4
Aug 3, 2016

What is the output of the following program? class Poly { static int length; int width; public Poly(int l, int w) { length = l; width = w; } int area() { return 2*length*width; } } class Rect extends Poly { public Rect(int l, int w) { super(l,w); } int area() { return length*width; } } class Solution { public static void main(String args[]) { Poly rect1 = new Poly(5,5); Poly rect2 = new Rect(6,4); int area1 = rect1.area(); int area2 = rect2.area(); System.out.println(area1 + " " + area2); } } 30 24 60 48 60 24 25 24 50 48 48 24 50 24

Viewing 531 - 540 interview questions

Glassdoor has 270,956 interview questions and reports from Developer interviews. Prepare for your interview. Get hired. Love your job.