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

-1
votes
0answers
11 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 ...
0
votes
2answers
28 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 ...
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 ...
-5
votes
3answers
80 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 ...
-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
95 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. ...
-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 ...
-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 ...
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 ...
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 ...
-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
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
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 ...
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 ... } } ...
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 ...
-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 ...
-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 ...
-4
votes
0answers
60 views

Encrypting a zip file [closed]

Hey guys m new to android, I want to encrypt zip file that i generated. inside the zip file I have files. So I want to encrypt the zip file. Its my first time to work with encryption. I did my own ...
-2
votes
0answers
15 views

anything better than Sikuli-api-1.0.2 [closed]

I need to draw some patterns on a website page as a tutorial, I am using Sikuli API, do we have anything stronger? for example I need to draw Circle around some components but Sikuli circle are too ...
5
votes
1answer
113 views

Where to initialize objects

I have an BallEntity class that is part of a game that uses a Entity Component System architecture. This class have 'components' that are like the attributes of that class. I create and initialize ...
0
votes
0answers
43 views

Naming a class: Shadowing or Mirroring or something else?

The following class basically seeks to maintain a copy of the contents of a JMS Topic. The method onMessage() is called whenever a Messages arrived on a JMS Topic. public class TopicListener { ...
1
vote
0answers
59 views

Efficient extensions of degree of separation

I'm trying to play around with the 6 degrees of separation problem, specifically the Kevin Bacon game to find alternative ways of playing the game. I want to eventually port it over to MapReduce, but ...
4
votes
1answer
101 views

Separate interface for mutation methods

I've been working on refactoring some code, and I think I may have taken the first step down the rabbit hole. I'm writing the example in Java, but I suppose it could be agnostic. I have an interface ...
3
votes
0answers
83 views

Nested POJOs, exposing collections, detecting changes

I have a couple plain object classes to represent data read from a file. They look something like this: public class Command { private String name; private List<Message> messages; } ...
-2
votes
0answers
42 views

JAVA: Help Debugging / Optimizing Brute-Force Password Cracker [closed]

I have not done much with Java lately, so I have forgotten some things. I am trying to build a brute-force password cracker in which the user enters a password of special characters / alphanumeric ...
-3
votes
0answers
94 views

Is RxJava something that we need to learn or is it just a fad? [closed]

RxJava is a library that solves a very specific problem - shortens the code needed to observe data streams on/from any thread. (At least that's how I see it) It has a very steep learning curve. I ...
-5
votes
0answers
36 views

How to develop a facebook like chatbox using Java Web Development [closed]

. To create a chat Application like google hangouts or facebook chat what concepts should be used and how to proceed further? Please guide me step by step
1
vote
2answers
88 views

Find the maximum number of pairs of numbers that are in a range, between two arrays

Lets say I have two arrays A and B A = {1,2,3} B = {12,11,67} and have max sum value S = 10 How many maximum number of unique pairs can be formed between the two arrays who's sum is less than or ...
1
vote
2answers
87 views

Naming convention for getting the primitive backing a type?

I have a class that is backed by a double value, and I am wondering about accessor method names that preserve abstraction. Based on my experience in Java, there seems to be at least two precedents: ...
1
vote
1answer
122 views

How can I make an object/class inaccessible to Reflection

I am building an API for minecraft called the Quantum API. We all know that reflection can be used to do some nasty stuff to classes, and even cause undefined behavior if used without care. Is there ...
3
votes
2answers
90 views

Does a serializable singleton imply both value and reference semantics at the same time?

I was reading Effective Java, and I came across passages that talk about ways you might implement a serializable singleton, as if this was a perfectly normal thing to do in Java. This immediately ...
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 ...
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 ...
0
votes
0answers
30 views

Map-Reduce sorting: before or after partitioning?

At some point, the (key,value) outputs of the mappers are sorted by key.As I understand, this sorting doesnt take place locally on the node of the mapper.So I can think of two possibilites: 1) does ...
2
votes
2answers
164 views

Has-A or Is-A or some strategy pattern?

I am developing a web based application which is about tracking Fleet units. Actually i have already developed the system but in the last six years things changed a bit. Ordinary the software ...
0
votes
0answers
28 views

JavaFX Synchronize DataModel with Business Domain

I am currently working on a javaFX (first time) frontend for one of our applications. For this i'm using a simple MVC pattern where my model classes use properties so that i can directly bind them to ...
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); } ...
4
votes
3answers
191 views

Java & REST API: How do I check for duplicate before inserting record?

I am developing an application in Java to parse and upload records from a CSV to an online database, via a REST API. While I know for sure that there are no duplicate records in each CSV file, I ...
0
votes
2answers
180 views

Why 'class String' definition has 'final' modifier? [duplicate]

This answer gives an indication that class String is declared final for thread safety, which does not convince. This answer does not convince when it says: And so, you make the classes final. There ...
32
votes
6answers
4k views

What's the point of implementing a Stack using two queues?

I have the following homework question: Implement the stack methods push(x) and pop() using two queues. This seems odd to me because: A Stack is a (LIFO) queue I don't see why you would need ...
1
vote
2answers
85 views

Dependency injection of ViewModel with unmanaged parameter

I have a PersonEditViewModel which needs two other objects, the personId and the PersonRepository. PersonRepository is obtained from a service locator: private final int personId; public ...
1
vote
3answers
69 views

When is a event listener invoked during program execution?

I am using the Obervable-Observer Pattern. MyClass extends Observable{ invokeListeners(){ doSomething; setChanged(); notifyListeners();//This invokes onUpdate() in "implements ...
0
votes
0answers
20 views

WebService NameSpace doubt

I am creating a java webservice. For that I am using @WebService annotation and @WebMethod for defining endpoint and service respectively. In both place I have option to provide targetNameSpace. Can ...
1
vote
1answer
88 views

If the representation part of type abstraction is declared private, then how does sub-classing violate encapsulation?

Here, I learned that sub-classing violates encapsulation: it violates encapsulation, since the implementations of the superclass and subclass become tightly coupled For instance, If we consider ...