Java Engineer Interview Questions

27,719 java engineer interview questions shared by candidates

5. The user of this class expected the output “Num: 1000000”. They got something else. What went wrong and how would you fix it? public class Test { public final static int NUMTHREADS = 1000; public final static int NUMLOOP = 1000; public static int num = 0; static class Mythread extends Thread { @Override public void run() { for (int i = 0; i < NUMLOOP; i++) { ++num; } } } public static void main(String argv[]) { Mythread threads[] = new Mythread[NUMTHREADS]; for (int i = 0; i < NUMTHREADS; ++i) { threads[i] = new Mythread(); threads[i].start(); } try { for (int i = 0; i < NUMTHREADS; ++i) { threads[i].join(); } } catch (InterruptedException e) { } System.out.println("Num: " + num); } }
avatar

Java Engineer

Interviewed at Nextlabs

3.8
Jan 12, 2012

5. The user of this class expected the output “Num: 1000000”. They got something else. What went wrong and how would you fix it? public class Test { public final static int NUMTHREADS = 1000; public final static int NUMLOOP = 1000; public static int num = 0; static class Mythread extends Thread { @Override public void run() { for (int i = 0; i < NUMLOOP; i++) { ++num; } } } public static void main(String argv[]) { Mythread threads[] = new Mythread[NUMTHREADS]; for (int i = 0; i < NUMTHREADS; ++i) { threads[i] = new Mythread(); threads[i].start(); } try { for (int i = 0; i < NUMTHREADS; ++i) { threads[i].join(); } } catch (InterruptedException e) { } System.out.println("Num: " + num); } }

Programming Round: 1) Write a program count 1 to 50 number. Every multiple of 3 it should print " Manhattan " and Every 5 multiple it should print " Associate " and combination of 3 and 5 multiple. it should print "Manhattan Associate". 2) How to create class for Smartphone feature using oops concept. Databse: They Given Three table : shellar name,Customer,order: 1) find out all shellarename who ever purches Maruti car. 2) find out all shellername who ever purches Honda and indika car.
avatar

Software Engineer On Java Technologies Having I Yr Experiance

Interviewed at Manhattan Associates

3.8
Feb 13, 2016

Programming Round: 1) Write a program count 1 to 50 number. Every multiple of 3 it should print " Manhattan " and Every 5 multiple it should print " Associate " and combination of 3 and 5 multiple. it should print "Manhattan Associate". 2) How to create class for Smartphone feature using oops concept. Databse: They Given Three table : shellar name,Customer,order: 1) find out all shellarename who ever purches Maruti car. 2) find out all shellername who ever purches Honda and indika car.

Viewing 211 - 220 interview questions

Glassdoor has 27,719 interview questions and reports from Java engineer interviews. Prepare for your interview. Get hired. Love your job.