Java Software Developer Interview Questions

4,192 java software developer interview questions shared by candidates

Write a function in Java that would accept two parameters, a string and any type of Object. The Object could have any number of fields (all public, just to simplify the question) that have any names. The string would then be written as follows: "{:name} went to {:location} to buy {:item}." Whenever you reach (without quotes) "{:something}", then you have to see if the object contains a field with the name inside (in this case, if it contains "name", "location", or "item". You would then convert it to what the object says. You can assume all fields are stored as Strings, even if they are numbers. The signature would be something like this: public static String decode(Object o, String s);. Example: Object o fields: name="Jerry", age="52", location="Walgreens", gender="male". String s: "{:name} went to {:location} to buy {:item}." Result: "Jerry went to Walgreens to buy {:item}." ({:item} never changed because the object doesn't have an item field.
avatar

Java Software Engineer

Interviewed at 1stDibs.com

3.6
Oct 19, 2016

Write a function in Java that would accept two parameters, a string and any type of Object. The Object could have any number of fields (all public, just to simplify the question) that have any names. The string would then be written as follows: "{:name} went to {:location} to buy {:item}." Whenever you reach (without quotes) "{:something}", then you have to see if the object contains a field with the name inside (in this case, if it contains "name", "location", or "item". You would then convert it to what the object says. You can assume all fields are stored as Strings, even if they are numbers. The signature would be something like this: public static String decode(Object o, String s);. Example: Object o fields: name="Jerry", age="52", location="Walgreens", gender="male". String s: "{:name} went to {:location} to buy {:item}." Result: "Jerry went to Walgreens to buy {:item}." ({:item} never changed because the object doesn't have an item field.

java programming ) What is the output of the following Java program? class Test { public static void main (String args[]) { System.out.println(10 * 20 + "Javatpoint"); System.out.println("Javatpoint" + 10 * 20); } }
avatar

Java Software Developer

Interviewed at InputZero

3.7
Nov 4, 2022

java programming ) What is the output of the following Java program? class Test { public static void main (String args[]) { System.out.println(10 * 20 + "Javatpoint"); System.out.println("Javatpoint" + 10 * 20); } }

Viewing 561 - 570 interview questions

Glassdoor has 4,192 interview questions and reports from Java software developer interviews. Prepare for your interview. Get hired. Love your job.