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

-3
votes
1answer
116 views

Does a static class have to be nested?

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 ...
5
votes
2answers
106 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 ...
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){ ...
-6
votes
0answers
24 views

How can I hook Unity to browser? [on hold]

I am trying to hook a unity game to my browser. Any idea on how to do this? I am trying to hook it to a game on the browser so it can run my modified server. I have all the files and it works ...
-3
votes
1answer
33 views

Simple addition program [on hold]

I can't figure out why my program won't return the sum of the numbers I input it just returns "sum=" import java.util.Scanner; public class Integers2 { public static void main(String[] args) { ...
2
votes
0answers
27 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 ...
2
votes
5answers
478 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 ...
1
vote
0answers
30 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
104 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
79 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 ...
5
votes
2answers
1k 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 ...
-3
votes
1answer
70 views

How much should earn a developer for a freelance job? [on hold]

I am a software engineer with 5 years of experience. I am starting to work as freelance for some jobs extra, and I don't have so much clear how much should be my price per hour. I work as Java ...
0
votes
1answer
150 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
28 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 ...
-3
votes
3answers
82 views

How do I check my object's class in Java? [on hold]

I would like to know how to check what class my object originated from like if Object JoeThompson came from Supervisor or Programmer?
-4
votes
1answer
45 views

New to Java, Question Concerning Loops [on hold]

I am new to Java. I was wondering how to complete a user-defined number of loops. Here's the code I have right now: package diceroller; public class DiceRoller { public static void main(String[] ...
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
62 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
32 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
237 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
122 views

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

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 !!
-4
votes
0answers
31 views

Redistributing data loading [on hold]

I am writing a system that does a lot of http requests, and fetches a lot of json data. I have a goal to fetch a lot of data within short period of time. Just to give some measurement: one request ...
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
219 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
245 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
841 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 ...
-1
votes
8answers
1k views

How can I get started writing code? [closed]

I am currently learning Java in college. I have noticed a problem I have when I am starting to code to solve problem. The problem is that I don't know exactly how to start. For instance, if I try to ...
3
votes
1answer
133 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
387 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
198 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
75 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
128 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
657 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
55 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 ...
3
votes
1answer
227 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
85 views

What is the point of the dao layer? [closed]

With the current technologies which are pretty good (JPA, Hibernate, others), what is the point of the DAO layer? It's very rare for a project to switch its backend from one vendor to another, so it's ...
2
votes
1answer
217 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
3answers
282 views

'Encapsulation Vs Performance' trade-off in a lockable linked list

Main purpose of encapsulation is to protect in-variants of any class(in java). Here is the complete code for class DList/class lockDList/class DListNode/class LockDListNode. class DList and it's ...