170 Answered Questions for the topic Java

04/03/19

How to determine an object's class?

If class `B` and class `C` extend class `A` and I have an object of type `B` or `C`, how can I determine of which type it is an instance?

04/03/19

.war vs .ear file?

What is the difference between a .war and .ear file?

04/03/19

How to convert byte size into human readable format in java?

How to convert byte size into human-readable format in Java? Like 1024 should become "1 Kb" and 1024*1024 should become "1 Mb".I am kind of sick of writing this utility method for each project. Are... more

03/27/19

Is this a good test for a selenium developer?

My boss has given me the assignment of interviewing one of the new automation engineers. The only task left is the technical one, and I have been thinking about a good test that I could give... more

03/27/19

Check whether a string is not null and not empty?

How can I check whether a string is not null and not empty? public void doStuff(String str) { if (str != null && str != "**here I want to check the 'str' is empty or not**") { ... more

03/26/19

In Java, how do I check if a string contains a substring (ignoring case)?

I have two strings, str1 and str2. How do I check if str2 is contained within str1, ignoring case?

03/26/19

String concatenation: concat() vs "+" operator?

Assuming String a and b: a += b a = a.concat(b) Under the hood, are they the same thing?

03/26/19

How can I increment a date by one day in Java?

I'm working with a date in this format: `yyyy-mm-dd`. How can I increment this date by one day?

03/18/19

Is PHP front end or back end?

03/18/19

Is Python front end or back end?

03/18/19

What technology should I use to create a distributed Accounting Software?

Here are my current options. 1. .Net : Using WPF, Visual C#, SQLServer 2. Java : Using Spring, Hibernate, Enterprise DB, web-based Can you suggest which one is better?, especially with regards... more

03/18/19

How to convert AutocadDWG To PDF?

Is there another way to convert AutocadDWG To PDF but to use third party programs? Thanks for any suggestions.

03/18/19

How do I count the number of occurrences of a char in a String?

I have the string a.b.c.d. I want to count the occurrences of '.' in an idiomatic way, preferably a one-liner. (Previously I had expressed this constraint as "without a loop", in case you're... more

03/18/19

How can I simplify this set of if statements? (Or, what's making it feel so awkward?)?

My colleague showed me this piece of code, and we both wondered why we couldn't seem to remove duplicated code. private List parseResponse(Response response) { if (response.status().code() !=... more

03/18/19

What is front end and back end web development?

03/18/19

Why does this if statement, with an assignment and equality check, evaluate to false?

How does a Java *if statement* work when it has an assignment and an equality check `OR`-d together?? public static void test() { boolean test1 = true; if (test1 = false || test1 == false) { ... more

03/18/19

Is JavaScript front end or backend?

03/18/19

Fastest way of finding the middle value of a triple?

Given is an array of three numeric values and I'd like to know the middle value of the three. The question is, what is the fastest way of finding the middle of the three? My approach is this kind... more

03/16/19

How do I parse command line arguments in Java?

What is a good way of parsing command line arguments in Java?

03/16/19

What is the point of "final class" in Java?

I am reading a book about Java and it says that you can declare the whole class as `final`. I cannot think of anything where I'd use this. I am just new to programming and I am wondering **if... more

03/16/19

How to convert Milliseconds to "X mins, x seconds" in Java?

I want to record the time using `System.currentTimeMillis()` when a user begins something in my program. When he finishes, I will subtract the current `System.currentTimeMillis()` from the `start`... more

03/16/19

How to convert comma-separated String to ArrayList?

Is there any built-in method in Java which allows us to convert comma separated String to some container (e.g array, List or Vector)? Or do I need to write custom code for that? String... more

03/16/19

checking if a point is inside a specified Rectangle?

ok, so i'm doing an assignment for a Java class and one part of the assignment is to find out if a point is within the dimensions of a rectangle. so I created this code: public boolean... more

03/15/19

Check whether a string is not null and not empty?

How can I check whether a string is not null and not empty? public void doStuff(String str) { if (str != null && str != "**here I want to check the 'str' is empty or not**") { ... more

03/15/19

Java tree data-structure?

Is there a good available (standard Java) data structure to represent a tree in Java? Specifically I need to represent the following: - The tree at any node can have an arbitrary number of... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.