java developers Interview Questions

20K

java developers interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Insight Global
Junior Java Developer was asked...November 15, 2012

Implement a method to determine whether a string is a palindrome.

4 Answers

Take a string as function parameter. Copy this str value into a new var, then use .reverse() thereupon. Compare the reversed copy back against original string using turnery operator to set resVariable to "true" : "false". Return resVariable. Less

(Using .split(""), as well as .join(""))

const palindrome = (str) => str == str.reversed() palindrome('hello') // false palindrome('eve') // true Less

Show More Responses
Lanyon

Write a function to print the first letter of every word in a string.

4 Answers

public String getFirstLetters(String text) { String firstLetters = ""; text = text.replaceAll("[.,]", ""); // Replace dots, etc (optional) for(String s : text.split(" ")) { firstLetters += s.charAt(0); } return firstLetters; } Less

let sentence = 'Big Green Dog' let words = sentence.split(' ') words.map((word) =>{ word.split('') console.log(word[0]) }) //output "B" "G" "D" Less

public static void PrintFirstLetter( String s ){ If ( s.length == 0 ){ return; } String [ ] Words = s.split( “ “ ); for ( String word : Words ) { System.out.println( word.charAt(0)); } } Less

Show More Responses

How would you scale access to a system like Twitter

3 Answers

I was thinking geographically distributed servers.

Cf

There's probably no real correct answer, though the solutions go from common to esoteric in a pretty normal progression: caching, shared-cache like memcache, optimize usage, prefetch, then get creative. This is more about testing reasoning and how far you'll go to solve a problem. Less

Help Scout

Write a method to determine if a string starts with an uppercase letter.

2 Answers

wouldn't it just be return string.charAt(0) == string.charAt(0).toLowerCase()

bool lower(string s) { if (s.length() == 0) {return false;} char f = s.at(0); return (f > 64 && f < 91); // ascii values } Here’s a C++ implementation that might (not) work. Not so good with Java. Less

SAP

1.Java Basics. 2.Plethora of Multithreading questions.GC 3.Simple data structure. (BFS) variation 4.Database Basics

1 Answers

I fumbled in 1 questions which was the nail in the coffin.

N2N Global

Q: Why multiple inheritances are not supported in Java?

1 Answers

Because of diamond pattern, diamond pattern creates ambiguity and make problem for compiler. Anyway java supports multiple inheritances via interfaces. I think more convincing reason for not supporting multiple inheritance is complexity involved in constructor chaining, casting etc rather than diamond. Less

Western Governors University

What does the action and method attribute in the HTML <form> tag do.

1 Answers

action = specifies where to send the form data when form is submitted method = specifies how to send the form data (get or post) Less

BzzAgent

Lots of questions about arrays, lists and hashmaps

1 Answers

Focus more on how hashmap works and its applications

BzzAgent

If you were responsible for development and launch of a billing system, how would you handle a critical situation?

1 Answers

My answer: 1. Pause or isolate the problematic process/workflow if possible 2. Study the logs and relevant data 3. Try to reproduce locally (in a sandbox) 4. Try to reproduce in staging environment 5. Add and deploy fix, enable the process/workflow back 6. Follow up with affected customers via support Less

Accenture

Difference between JDBC and Hibernate

1 Answers

JDBC is a clumsy java approach for db talks while hibernate being one of the leading ORM tool needs data defined on entity class only to do the DB talk Less

Viewing 1 - 10 of 20,063 Interview Questions