Skip to content

Tag: java

Is my package structure correct?

What should be the hierarchy of packages? Is this package structure appropriate? Answer I am actually against layer-driven packaging but instead I advice feature-driven approach: The reasoning is: you’ll much more often want to have all classes related to person functionality in one place. Not often you…

Eclipse is executing the wrong Java file

I am using Eclipse to write and test Java. I am a beginner so i don’t know anything about Eclipse. The problem occurs when I try to run the Java file I just wrote. Instead of executing the file that is opened, it executes the file that I have successfully ran before. I have a few files in the same

Java Returning method which returns arraylist?

I have one class with a method like this: how can i call this method inside another class? Answer 1. If that class from which you want to call this method, is in the same package, then create an instance of this class and call the method. 2. Use Composition 3. It would be better to have a Generic ArrayList

JMS AUTO_ACKNOWLEDGE when is it acknowledged?

I have tried to google this, but have not been successful. If I am using AUTO_ACKNOWLEDGE, and I have a consumer client written in Java, when is the message acknowledged? I am using a MessageListener which contains an onMessage method. Is the acknowledgement sent back to the server before onMessage or after o…

BubbleSort Implementation

I tried to make an implementation of bubble sort, but I am not sure whether it is correct or not. If you can give it a look and if it is a bubble sort and can be done in better way please don’t be shy. Here is the code: Answer This is the calssical implementation for bubble sort and it

When to use @QueryParam vs @PathParam

I am not asking the question that is already asked here: What is the difference between @PathParam and @QueryParam This is a “best practices” or convention question. When would you use @PathParam vs @QueryParam. What I can think of that the decision might be using the two to differentiate the info…