Java Programmer Interview Questions

295

Java Programmer interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Barclays
Java Programmer was asked...January 15, 2010

Assume there is a method provided getNextperson() which gives Person objects which have comparable interface implemented, now read from a file records and sort it and give first 1000 records, write code on the paper

6 Answers

The question is actually quite simple since you were given that Comparable interface is already implemented (eg, public int compareTo(Object o) method is overridden in Person object). First step, 'read from a file all records' and store each Person object returned by getNextPerson() in List records = new ArrayList(). Next step, call Collections.sort(records) to sort (by criteria specified in compareTo() method, such as Last and First name, or any other meaningful parameter). Final step, 'give first 1000 records' -- either by iterating over first 1000 (checking size() >= 1000) or by returning the list consisting of only 1000 records (either copy into a new list with size 1000 or by using removeRange method in ArrayList. Less

maybe use tree data structure

tree data structure ? i hope u meant to say "TreeSet"; but the question doesnt say that getNextPerson() will be unique. So let us not bank on treeSet. So just add them on to a arrayList and do a Collections.sort(arrayList); Less

Show More Responses
Citrisys

What is java?

5 Answers

It is a platform independent programming language

java is a programming language and it is a platform independent .

Java is a high level, platform independent, object oriented, programming language Less

Show More Responses
Barclays

Write code to return a sorted array of int, when passed in 2 sorted array of int to the method.

4 Answers

consider using only 1 loop

1 loop only if 2 it becomes n2

use loop meaning 1 loop? or 1 inside of another?

Show More Responses
Barclays

what is the output public class Barclays { static class A{ A(){ f(); } public void f(){ System.out.println("A ctor"); } } static class B extends A{ B(){ f(); } public void f(){ System.out.println("B ctor"); } } public static void main(String[] args) { B b = new B(); b.f(); A a = new A(); a.f(); } }

2 Answers

The first line is A ctor as the first line of any constructor is super()

B ctor B ctor B ctor A ctor A ctor

Microsoft

how are you? Have you ever worked

2 Answers

fine thanks

no but i have experience

MindGate Solutions

In first round having programs and aptitude. which is a optional type questions and then second round is technical round.final round is hr

2 Answers

Aptitute

I clear three rounds of interview but I did not select for that job.

TekVista

1. Initially Lot of those cliché questions like "what was the most challenging project?, why it was challenging? what was your role? what particular task made it challenging? Why not tried some other way? What did you learn from that experience?" 2. The HR person asked me lot of critical thinking questions. lot of them were on internet... :) 3. Asked why do I like consulting, and why not try for a permanent job at some big company ?

1 Answers

Since I was a heads down programmer, I was not well versed with those kind of "GOTCHA" questions., even though my friend warned me that they may ask those cliché questions... Less

ImpetusIT

How do you construct JDBC driver

1 Answers

well Explained

Citrisys

Have u done any course?

1 Answers

Yes, core java/j2ee

Viewing 1 - 10 of 295 interview questions

See Interview Questions for Similar Jobs

python programmerjava engineercomputer programmerjava developerjava software engineerweb programmerc programmerjava software developerj2ee developerphp programmer

Glassdoor has 295 interview questions and reports from Java programmer interviews. Prepare for your interview. Get hired. Love your job.