Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

learn more… | top users | synonyms

0
votes
0answers
8 views

DICOM Image Orientation evaluation in Java

I have been trying to find this out since a long time, but due to lack of any experience in Java, I am totally lost. I want to do some operations in DICOM in Java. I have used ImageJ library to simply ...
-5
votes
3answers
77 views

Why different languages have different syntax?

Different programming language always/most of the time use different syntax. For example take PHP, Java and Python. In Php & Java semicolons are compulsory at the end of the line, yet Python ...
0
votes
2answers
27 views

Using GNU GPL with classpath exception licensed library in a GNU GPL licensed project

I am working on a project that uses ABCL. License of ABCL is GNU GPL with classpath exception, which means we can link this library with independent modules to produce an executable, regardless of the ...
-2
votes
0answers
29 views

How to deserialize multiple objects from file [on hold]

I have this much code with me. Deserialization works fine for one object but not for many. i even tried by checking while((i=fin.read())!=-1) but it's not working Please help me with it public class ...
1
vote
1answer
269 views

Static methods vs Interface implementation

Here is my problem: I stared to create an e-commerce web site info collector. So I created a parser for each site. The parser class is stateless. I have got methods like: getItemPrice(WebElement ...
0
votes
1answer
71 views

Is the use of set / get prefix discouraged for methods if they don't actually mutate / access fields

This could be a quirk of the IDE I am using, Android Studio, or it could be something more nuanced that I don't understand. I have a method setCustomFont that appears as a property in the Structure ...
2
votes
2answers
143 views

Is it worth it to use a message-queue framework in this case?

We have these things called "executions" that are run at certain times. They have a delay property that basically says "execute me after delay microseconds`. Currently we are using Cassandra as a ...
10
votes
2answers
390 views

Packaging structure of Java collections (java.util) - why does Iterable sit in java.lang?

As per the below diagram, except for interface Iterable, all the remaining constructs (interface / class / abstract class) sit in same package java.util   Why does Iterable sit in ...
-4
votes
0answers
24 views

Convert String to Integer Code in Java [on hold]

help me to solve this problem Q: find the largest number in the String by using substring() function? In fact, I did it by using Integer.parseInt() function and it runs, so I was wondering if there ...
2
votes
1answer
94 views

interpretation of the statement in java

I am confused over the interpretation of the following statement Fruit x= new Fruit(); My interpretation is that the new operator along with Fruit(); creates a new object somewhere in the memory. ...
4
votes
1answer
448 views

Scheduling a few CPU-intensive tasks

I need to schedule a small number of CPU-intensive tasks to run every so often, reading from shared data and writing to dedicated buffers. I don't necessarily want to roll my own scheduling, but am ...
1
vote
2answers
122 views

What is the algorithmic time complexity of this program?

I wrote a simple program in java to create and maintain Dynamic Arrays: public class DynamicArrays { private Integer[] input = new Integer[1]; private Integer length = 0; private Integer ...
0
votes
4answers
99 views

Handling DomainExceptions using REST endpoint

Suppose I'm doing some DDD. Now, I have a microservice reflecting a bounded context/a part of a bounded context. Now, suppose there is a REST endpoint: '/somedomainmodel/someaction' My API user is ...
-3
votes
0answers
32 views

Java Program Output Incorrect [on hold]

I am having a horrible time trying to get this program to output correctly. The program has no errors, but when I run the "test" it outputs: Also when I run the program to enter my own data the ...
0
votes
1answer
93 views

How are the forwarding of requests normally managed in the Chain of Responsibilty pattern? [closed]

I was just experimenting with the Chain of responsibility design pattern, implementing my own version. I'm currently reading Design Patterns, but I'm not really sure whether DP tells to stop the ...
-5
votes
0answers
22 views

About Files converted From OCR? [on hold]

Is there any software or process to find the OCRd files? If anyone have idea on this please reply asap.
-3
votes
0answers
20 views

I want to retrieve image from mysql database using servlet and show that image along with that user details in table

Everything is working well. When I delete Code for Retrieving image then I get user details in table and when I put the code to retrieve image along with the code of printing user details then I only ...
-6
votes
0answers
20 views

How to build hotel reservation panel with month view in core java [on hold]

I want to build a hotel reservation system for desktop using core java but when i come to reserve a room for multiple dates it becomes brick always, i also want a month view which show booked and ...
2
votes
2answers
306 views

A 'task' system which has an ending, to get ready for next task

I want to make a system, so that there are certain tasks. For example, let's talk about a game. I want to make it so there are 100+ tasks doing different things, but when the player's magic level is ...
1
vote
1answer
45 views

Do my “dal” and “fileHandler” interfaces overlap?

I want my program to: read some input lines from CSV file write the output lines to plain string file read some input from the same file in (2) and compare it to some calculated data I want to ...
1
vote
3answers
130 views

How to use Guice for an effective API Design?

I am creating a base API in JavaSE, which includes modules like MVP architecture, Service & Repository Layer, Event Model to fire events between presenter etc. I am trying to implement all best ...
3
votes
2answers
1k views

“Clean Code”: How to organize named queries?

Few days ago I started to read Robert C. Martin "Clean Code" book and it encouraged me to look more detailed at my code. After I opened eclipse I saw this: ...
2
votes
1answer
336 views

DataMapper for a MMO game plugin to send packets

I am working on an plugin for some game-server. The information about the plugin is not really necessary. Few points you might find helpful to answer to this question: The server The server is ...
1
vote
2answers
298 views

Mnemonic for always overriding equals when you override hashCode? [on hold]

We java developers always know that you should always override equals() when you override hashCode(), but I consistently have trouble remembering this rule. What is a clever mnemonic to help Java ...
0
votes
1answer
26 views

JEE MVC, controller calls the interface instead of the interface implementation

I'm following this tutorial: http://wiki4.caucho.com/Building_a_simple_listing_in_JSP It creates a basic web application in Eclipse using the MVC pattern with Resin as the web container. Here's the ...
0
votes
0answers
60 views

Pattern to share fields in inheritance

I'm trying to figure out the best way to solve a design issue. I have to be able to clone (I'm cloning them to Apache HttpClient) different types of HttpServletRequest (POST, GET...) and then send ...
-2
votes
0answers
11 views

How to pass a string value to a String with “ ” [on hold]

So it's kinda a simple thing but i can't find a way to do it without getting a syntax error.So i want to pass a string value from a variable to another.So lets say i have a variable. String view= ...
0
votes
4answers
197 views

Is collection object better being immutable? [closed]

As per this link, it is an advice that: A good object should never change his encapsulated state. Remember, an object is a representative of a real-life entity, and this entity should stay the ...
1
vote
1answer
113 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
0
votes
0answers
54 views

Strategy for writing a scalable chat server in Java [on hold]

Currently I'm creating a chat server in Java using socket, seems that is the natural choice for a newbie java programmer. What are the strategies that need to be taken in order to scale the chat ...
0
votes
1answer
3k views

Converting Java applet to web application [on hold]

I would like to convert this Java applet into an equivalent web app. This is my first time creating a web app, but I have some programming experience and time, and am willing to teach myself all of ...
0
votes
1answer
309 views

How to update User interface form through database update

I have a client server application. Assume I work as a Support executive, resolving customer tickets. We(our support team) have got two tickets to work on. Ticket 1: Client "Liver" raised a ticket ...
2
votes
1answer
271 views

Should we encapsulate everything in a try{} block in a Try object?

Why can't I make a class for a Try including what I try and then run that in the try {} block? Why is it impractical? class DBConnectTry extends Try { TryResponse response[] attempt(TryObject ...
1
vote
1answer
126 views

Design pattern for ensuring the “signature” of generic lists is equal

I have an interface, Attribute, that is going to be implemented in various ways, class AttributeA implements Attribute{\\..} class AttributeB implements Attribute{\\..} Then I'm planning to have ...
8
votes
3answers
8k views

How is multi-threading different in a Java based Web Application vs Stand-alone Java Application

I am fairly new to Java and my experience is limited to Web Based Applications running on a Web Container (Jboss in my case). Am I correct in saying that for Web Applications the web container takes ...
1
vote
1answer
179 views

What would be the best way to implement priority based programming without adding too much of if-else processing logic

We need to add priority based programming in our application using java programming language. For example, there are three priorities that a phone can have: A1, A2 and A3. Also there can be three ...
0
votes
2answers
578 views

Is factory pattern a right pattern for the situation described here?

Is factory pattern a right pattern when we want to consolidate the related objects? Problem - In the Set-top box, I have a user-io, basically the interface to control the settop box - The user-io can ...
0
votes
2answers
83 views

Efficiently find whether Binary Search Tree is Height Balanced or not?

A binary tree is height balanced if and only if the two subtrees of root are height balanced and the difference between the two subtrees height is at most 1. I implemented a code in java to find ...
0
votes
1answer
20 views

Where to store (data) classes for webservices

So I'm pretty new in my current company and my current task is to create a webservice that sends some serialized java objects from service A to service B using jaxws (webservices). The senior on the ...
0
votes
2answers
71 views

guideline on void methods that do not throw exceptions

In our codebase I saw a method that is similar to following: public void doSomething() { try { ... } catch (Exception e) { ... //log something ... } } ...
-3
votes
0answers
33 views

.jar file to interact with C++ console application [on hold]

I know this is probably a difficult and/or insane question, but is there any way that I can make a .jar file that can type things into a C++ console application? I made a .jar GUI in netbeans, and I ...
39
votes
14answers
2k views

If you had two projects with the same specification and only one was developed using TDD how could you tell? [on hold]

I was asked this question in an interview and it has been bugging me ever since. You have two projects, both with the same specification but only one of these projects was developed using Test ...
3
votes
1answer
191 views

Debugging xml and annotations

By now, most web containers have an annotation variant of their xml configurations for Java EE. I'm guessing this is because it's better to keep things in Java where they can be managed, coded with ...
1
vote
1answer
134 views

Is a class representing a JSON response a DTO, a domain object, or something else?

Consider a restful service in Spring MVC. I am wondering how to package my response classes, i.e. how to name the containing package. First I thought of them as being domain objects. But they are ...
-3
votes
1answer
68 views

Java - Best way to set properties of an object [on hold]

I don't know if there is any difference in performance, or its just a matter of choice, but I am a perfectionist like that, and I'd like to know. Lets say you have the object HolySheet. You can set ...
0
votes
0answers
23 views

DDD Request Validation Handling

I stuck somewhere that I can't find a solution! There are plenty of validation questions here, but as far as I see, most of them were asking about entity validation. But what about request validation? ...
-2
votes
0answers
20 views

Difference between Eclipse+STS plugin and STS IDE? [closed]

What is usage difference between Eclipse + STS plugin and only STS IDE in terms of placing xml configurations and web.xml please explain in brief? I know sts has its own pivotal tcServer .But I ...
10
votes
1answer
289 views

Is it good practice to implement two Java 8 default methods in terms of each other?

I'm designing an interface with two related methods, similar to this: public interface ThingComputer { default Thing computeFirstThing() { return computeAllThings().get(0); } ...
3
votes
1answer
315 views

Is this database design good? What JPA Entities should I create for this design?

I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below. Is this design good ? Any suggestions for improvement are ...
299
votes
39answers
263k views

Why isn't Java used for modern web application development? [closed]

As a professional Java programmer, I've been trying to understand - why the hate toward Java for modern web applications? I've noticed a trend that out of modern day web startups, a relatively small ...