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

7
votes
5answers
292 views

When to use generics in interface design

I have some interfaces that I intend third-parties to implement in the future, and I provide a base implementation myself. I'll only be using a couple to show the example. Currently, they are defined ...
123
votes
7answers
117k views

What does the Spring framework do? Should I use it? Why or why not?

So, I'm starting a brand-new project in Java, and am considering using Spring. Why am I considering Spring? Because lots of people tell me I should use Spring! Seriously, any time I've tried to get ...
1
vote
3answers
81 views

How does recursive backtracking work ?

I am trying to figure out recursive backtracking, i have good understanding of recursion and till some extent the concept of backtracking too but i am having difficulty understand the chronological ...
0
votes
0answers
43 views

What is the use of stateless object? [on hold]

While it is possible to create a stateless object, I am curious to know a use case or advantage of the same. If a stateless object is created for only providing the behavior then I would prefer static ...
-4
votes
1answer
105 views

Unexpected IndexOutOfBoundsException

I was given a project in which there are lines like Object item = null; try { item = mShowsAdapter.get(0); } catch ...
1
vote
1answer
11k views

How to start learning Spring framework with all its associated functionalities? [closed]

I am going to delve into the nuances of Spring. I have a little information about this framework. So I am not going in blind. But still I will like to start it as a beginner and then move up the ...
-6
votes
0answers
68 views

Recruitment Questions for the UK [on hold]

this is a bit cheeky of me but I've been referred here by a developer friend of mine. I Work for the UK government and we have always used external companies for our coding needs. We have decided it ...
10
votes
6answers
24k views

Java serialization - advantages and disadvantages, use or avoid?

Serialization is used for persistence in Java. It may be okay to persist a few objects using serialization. But, for a large number of objects, ORM, Database etc might be better. It seems that ...
13
votes
0answers
1k views

Can an abstract class be instantiated? [migrated]

abstract class A { public void disp() { System.out.print("Abstract"); } } public class B { public static void main(String args[]) { A object = new A(){ }; ...
0
votes
2answers
222 views

Possible way to make java class builder more abstract by using interface required keys

I'm looking for a more abstract pattern for builders that handles required fields without the need of writing a validator that checks if all requried fields are set. I like this builder. But is ...
1
vote
0answers
128 views

Why aren't Java Collections put in a dedicated package

Why do they just reside in java.util and not somewhere more specialized like java.collections or java.util.collections? It could contribute to mess up with different unrelated code. Couldn't it? Was ...
1
vote
2answers
109 views

Should heavy initialization be stored as a static variable or instance variable?

I have a that class does not really specify any real object on its own but is more of a utility class. It has some data whose initialization is expensive. I see two options on how to store the data: ...
3
votes
6answers
547 views

Design decisions while porting a non object-oriented C program to Java

Background: My boss made a comment on porting a C program that acts as some a simulator that communicates with a remote process through sockets to Java. He didn't assign it to me, or to anyone for ...
-3
votes
0answers
133 views

Does a static class have to be nested? [on hold]

I have this problem: "Create a static class in java. This static class must be separate from the class that contain the main function." Is this possible? I thought java only supported nested static ...
7
votes
5answers
8k views

Is it not a good practice to handle runtime exceptions in the code?

I am working on a Java application, and I see that Run time exceptions are handled in many places. For example, try { //do something }catch(NullPointerException e){ ...
2
votes
0answers
41 views

Could Java import C++ classes from a library using JNA or JNI?

In past, I used JNI to access some winapi functions, however winapi is C and therefore just procedural. Now my plan is different and I need to know whether I'm going in the right direction. What I ...
1
vote
0answers
40 views

Decoupled architecture in Android

I am building an app for Android that will have multiple data sources depending on who is using it. N-tier architecture with a repository pattern seems like the right way to go about this but I am ...
1
vote
1answer
111 views

How does Java's Scanner (System.in) input's buffering actually work?

Over the last days, I've being reading questions as the one that follows: "Why is my input code not working?" I myself had a couple times problems getting the input working right... as far as good, i ...
-3
votes
0answers
81 views

How to Calculate result of two Pictures [on hold]

Here is the one picture I want to fill out character of this picture After correctly fill out character of this picture the result is shown Now problem is the here how can I compare of this two ...
6
votes
2answers
2k views

Why do we need an instance of the Scanner Class to get an Input on Java?

Java is object oriented, but, why do we need to create an object from the Scanner Class to get input? Couldn't next() methods, for example, just be Static? C looks to me pretty simpler as you just ...
0
votes
1answer
151 views

Why are Strings in StringPool considered insecure?

Passwords are recommended to be stored in char[] instead of String, as Strings are stored in StringPool. Read more here As per this question Strings in StringPool are not available directly. To ...
-1
votes
0answers
29 views

how to organize android activities to be related? [on hold]

I'm working alone on android Project , and this is my first complete android project , and there are many activities and more parts are related for each activity , I write each part (which is related ...
-3
votes
2answers
2k views

Difference between daemon and child thread? [on hold]

As per my knowledge daemon thread is a thread that runs in background(low priority thread) and also a child thread runs in the background when the parent thread runs foreground so where does the ...
1
vote
1answer
48 views

Is it appropriate to pass in a derivative to calculate the error of a Neural Net?

I'm reading a guide for back-propagation of a neural net, and it gives the error function as: Next work out the error for neuron B. The error is What you want – What you actually get, in other ...
0
votes
0answers
63 views

Make a program deactivate after time [duplicate]

What I am referring to is a free trial. I would like to have a program that runs to a user who downloads it just like normal. However, I want the program to deactivate and become useless after a ...
1
vote
0answers
35 views

Approaches to Modeling a Graph Database over the Google App Engine Datastore?

I want to model a graph database over the Google App Engine Datastore. I am currently working on creating a Link entity to model the concepts of link/edge/relationship to the graph of objects. I am ...
-1
votes
0answers
28 views

Optimal Persistance Solution in Java [on hold]

I've been working with Java and Spring for 2 years now. Before hand I work in PHP writing straight SQL, I would say I'm more SQL minded than ORM minded. I have struggled to really find a persistence ...
-3
votes
1answer
241 views

Java Start JNLP without paying to certificate authority?

I've noted that now it is difficult to run Java Web start files (JNLP) by Oracle for Java8, without a proper certificate, due to "security reason".It is breaking thousands of applications across the ...
7
votes
2answers
138 views

Optional features: default method or separated interface

Dedicated interfaces seems to be a good way to expose the optional features in a domain-specific type hierarchy. However, they impede the use of decorator and composite patterns, which is also common ...
-3
votes
0answers
21 views

Mixing then printing arrays, but they all end up the same anyways? [migrated]

I'm making a sudoku game. I have an array (puzzle[][][]) containing nine other arrays (zone1[][]-zone9[][]), which each initially contain {{1,2,3},{4,5,6},{7,8,9}} (and they're assigned those values ...
0
votes
2answers
124 views

whats the relationship between integration testing, TDD and Agile methodology? [closed]

I recently attended an interview and was asked whats the relationship between integration testing, TDD and Agile methodology? I am still puzzled how to answer the question !!
2
votes
2answers
382 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
3answers
220 views

Would combining enums with static strings in java be sloppy?

Currently my team has a number of constants defined as static final strings. I want to be able to iterate over these strings as if they were an enum in one location, but everywhere else they are used ...
1
vote
3answers
251 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 ...
7
votes
4answers
853 views

Should Objects with lots of fields be broken up? [duplicate]

When I have an Object that has lots of fields is it better to have them all as fields or try to find logical groupings as their own Objects and make those the fields? I guess it comes down to which ...
3
votes
1answer
135 views

Should a new type be created though it only wraps a single field?

Say I have an interface Species that's defined as public interface Species { String getId(); String getDescription(); } The question is simply this: Should I create different classes to ...
2
votes
1answer
388 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 ...
2
votes
3answers
92 views

Responsibility of the small business logic: in a class or in a method? [on hold]

I have separated business logic to many small blocks. Each block can be coded in small number of lines. Where should I put the block code? [A] in a method, grouped in the class by some same feature ...
5
votes
4answers
206 views

Is Java package level scope useful?

I understand the idea of package scope, and at times have even thought I wanted it. However, every time I set down with a serious intent to try using it I discovered it did not fit the needs I ...
0
votes
1answer
76 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 ...
14
votes
6answers
4k views

Why did Java make package access default?

I'm asking this question because I believe they did it for a very good reason and that most people do not use it properly, well from my experience in industry so far anyway. But if my theory is true ...
1
vote
1answer
147 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 ...
1
vote
3answers
129 views

How can I create an abstract parent class which uses data from an inherited class?

I'm getting my feet wet with Android app development and tying to find a good way to manage database interactions across multiple similar objects. My goal was to have a structure like: public ...
-1
votes
2answers
132 views

Modelling a parcel management application

Scenario/Context: I am working on an application which would find out the highest volume of parcel delivery based on the pin code of a particular area by reading a text file which has the list of ...
2
votes
1answer
174 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 ...
1
vote
1answer
289 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
658 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 ...
1
vote
0answers
56 views

Detecting surface faces of a huge 3D mesh/grid

I've written a module in my application that creates a mesh from existing coordinate and face data. The number of vertices in the mesh could easily exceed 10 million and the same goes for the faces. ...
-1
votes
0answers
53 views

Backpropagation in layman terms [closed]

I've been studying neural networks, and I'm beginning to understand the basics. I know what the backpropagation algorithm does. It feeds sample input and calculates an error against a given output. ...
0
votes
3answers
279 views

Unable to convince on data hiding

I am working on a Selenium + java project where all Web Element in a class are declared as - public class CheckoutPaymentConfirmpage extends WebPage{ public final Button btnPrintorder = new ...