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
31 views

Styleguide when coding in a static language

I am currently a junior engineer and keen on learning best practices and expanding my experience. My question concerns any static programming language such as Java, C#, C++ etc. When I am writing ...
1
vote
1answer
34 views

MVC like design with interfaces: How to handle basic objects?

I have an (android) application and decided that the presentation layer will get data only through strict interfaces from the controller. I am at the point where some basic objects need to be passed ...
0
votes
0answers
21 views

Java write to text file from multiple threads

I have a thread which read and insert new lines in same file. I must synchronized that file so that no other thread is not accessing the file at the same time. Here is how i will synchronize a file ...
10
votes
2answers
512 views

Which version of Java should I use for a desktop application to reach the most users?

Am I correct to assume that most end users are using an older version than Java 8? Since I do not want to force people to upgrade in order to use my application, should I plan it to use Java 7 or even ...
-2
votes
0answers
20 views

Specific knowlege and skills for making android apps [on hold]

I know this question has probably been posted already but i couldn't find a sufficient answer. I'm interested in learning how to make android apps, i already know how to code in java and i know oop. ...
0
votes
1answer
40 views

Lock object in base class: private or protected?

I have a base class that contains some lists, queues, and other fields which determine its state. In the base class I only access these fields within a protected lock object since there could be ...
0
votes
3answers
97 views

How to design a solution that needs dynamism using Inheritance

I have below code/classes/interfaces: An Interface: public interface Animal<A extends Animal<A>>{ void fight(A otherAnimal); } 2.Tiger class which is implementing Animal ...
0
votes
1answer
34 views

How is ServletContext created?

When the webapp gets loaded the container will create the ServletContext. There is only one ServletContext per webapp per JVM. The ServletContext object is contained within the ServletConfig ...
0
votes
0answers
3 views

Constructor Bug [migrated]

I am trying to make a class that represents an integer with 100 digits. Not so much because I need it, but to learn more about constructors. The constructor takes a String (all numbers) and places ...
-2
votes
0answers
39 views

Is it viable to use Java reflection for serialization/deserialization? [on hold]

I have quite a bit of experience with C# and .Net reflection, and have written my own serialization/deserializaiton module based on using .Net reflection to analyze the objects and their members. Now ...
-2
votes
0answers
21 views

Managing and accessing instances of classes [on hold]

This is for an assignment and I am stuck on how to access a class that would be instanced with user input. I cannot seem to see a way to instance a new AddressBook with a unique identity from user ...
-1
votes
0answers
39 views

How to do frequent deployment / rolling upgrades for a Java app?

We're developing a SaaS app in Java, built with Maven. It runs on Amazon on a (potentially) large number of servers. We'd like to deploy changes every day or two. We have a ton of unit and system ...
1
vote
1answer
107 views

Problems with OO design for application with pluggable components

I'm trying to refactor an ugly code and make it easly extendable in the future. The application should be nothing else but a series of components that have input(s) and output(s). The components ...
-2
votes
0answers
24 views

NullPointerException from tring to get seperate RGB components [migrated]

I am trying to get the seperate RGB components from each element in a 2D color array,but it keeps throwing a NullPointerException and I am not sure why. It might be something small that I missed, so ...
0
votes
1answer
65 views

Return values and exceptions

I wrote simple function that returns a string depending on which condition is TRUE. Here is my code: private String getMyString() { if(!mStrigMember.isEmpty()) { return mStrigMember; ...
1
vote
4answers
152 views

What is the proper way for these methods to function?

How can I properly design what a method or function should do? To clarify the question I am going to use an example from a simple (non GUI) hangman game I created. The design is simple, it has a ...
0
votes
0answers
69 views

Is there any necessity to pass a variable parameter to a method while the variable declared global? [duplicate]

I am writing a class in java of Monte-Carlo algorithm. Here is the written code - public class MonteCarlo { int[][] matrix; public void monteCarlo(List<Node> nodeList) { matrix ...
2
votes
5answers
146 views

Implement multiple separate interfaces or interface hierarchy

I've been refactoring one of my projects recently and ran into a decision I have to make. I have several interfaces: Entity: Something in the game world Actor: An Entity that can perform actions ...
0
votes
3answers
178 views

Why are there no java compiler alternatives to allow new functionality? [on hold]

For example, a new java compiler could allow for some breaking backwards compatibility to allow for things like overloading on generic types like: void foo(List<String> arr); void ...
11
votes
2answers
424 views

Java has the JVM, what does C have?

I know that C has a compiler but what determines execution performance? For example in an if else block, what if the code just had all ifs instead of if elses, what determines that all the ifs will ...
-1
votes
0answers
25 views

get rules of Weka J48 Decision tree [on hold]

I want to display a Weka classification tree to the end-user that I have generated using weka.jar in Java. But not the default tree in grey window titled as "Tree Visualizer" which is obtained via ...
2
votes
2answers
205 views

When to use a SortedMap interface?

The rule in programming is to use the most general interface possible. But the difference between Map and SortedMap is more subtle. They compile to the same bytecode [I think] No additional safety ...
-1
votes
0answers
35 views

Spring mvc Hibernate DAO layer architecture [on hold]

I need a suggestion related to project architecture...My project is spring MVC How can I create DAO layer using hibernate..there are two ways to do it 1. Create generic DAO and use it 2. Create DAO ...
-1
votes
0answers
29 views

Java platform/engine for blogging and forum [closed]

I have a task to build a website which supports user registration and login, would have a forum and would have multiple blog-like pages/streams for news, upcoming events etc. The page should allow any ...
1
vote
2answers
95 views

Caveats of using String.hashCode() on a switch on java < 1.7

There are several cases when I want to switch over a String input. I decided for implementing something like: public Object doStuff(String param) { switch (param.hashCode()) { case 1234546: ...
1
vote
2answers
129 views

My value checker function needs to return both a boolean and a message

I have a value checking function, something much like a credit card number checking function, that is passed in a string, and needs to check that the value is of the right format. If it's the right ...
7
votes
7answers
1k views

Does Oracle reap economic benefits by maintaining Java? [closed]

It occurred to me that many programming languages such as Python and Javascript are maintained by non-profit foundations. I can see why a foundation would update a free programming language- in order ...
-1
votes
0answers
14 views

Where is DataContract in Java SOAP based web services? [closed]

I was a .NET developer who had recently started working in Java. I am learning JAX-WS i.e., SOAP based Java web services. I want to know how to serialize a Data class in case of SOAP communication? In ...
1
vote
2answers
70 views

Adding Logging to a pre-existing Program

I have a game that I have been writing in java as a hobby for a number of years. I have very sparse logging, just some simple output when something goes really wrong. It's about 25,000 lines of code. ...
0
votes
0answers
3 views

I'm trying to solve the “knapsack” problem using Java and recursion [migrated]

This is for a school assignment and the professor stipulates that recursion must be used, and it must take a single line input in a gui box where the first number is the max capacity (weight) the ...
4
votes
2answers
173 views

Exception versus return code in DAO pattern

After reading a lot about the abusive use of exceptions in Java and how you should let an exception bubble up through the different layers of an application, I've come to a point where I don't know ...
-1
votes
0answers
18 views

WLP Transformer implementation in Java? [closed]

Input for our program is array of instructions (Expression [] instructions). Then iteratively starting from last instruction, and going backwards we searching for weakest pre-condition of single ...
-1
votes
0answers
38 views

Question concerning loops [migrated]

Hey guys first time posting on here, I have to make a program for school that asks the user to input the amount of items they want, and their respective price. After that they have to input the GST, ...
-3
votes
1answer
55 views

Request for some general advice from someone moving into software development [closed]

I've had a look around the StackExchange sites and this one seemed to be the most appropriate for my question. Apologies if I made the wrong choice, and I'm happy to hear alternative places to post. ...
2
votes
1answer
43 views

Transactions and subresources with JAX-RS

I'm porting an existing application RESTful API to a Java web framework -- I don't actually care which -- but it's proving hard to get the basics right. The core of the problem appears to be getting ...
-1
votes
0answers
47 views

How to retain escape characters like &quot; or &lt or &gt while parsing XML and writing them back as new XML file [closed]

Following is the code used and below element contents are changed which is not desired by replacing the escape character, <SelectionFilter>event.ProductType == ...
-4
votes
0answers
42 views

if you pass in a Map to another method and change it, does it change the original Map? [closed]

I'm a total beginner so sorry in advance if the answer is obvious. I'm learning about Maps right now, and I was wondering if I created a Map (with some random keys and values) in Method #1, and then ...
-3
votes
0answers
25 views

Incorporating a Java PLAY framework application with Google App Engine [closed]

I'm relatively new to web application development. Recently I created a neat little hack using the Java PLAY! framework and I got it to work and everything -- but on localhost. I bought a domain and ...
-2
votes
0answers
44 views

Freelancing process in web app development [closed]

I'm strongly considering doing some Java freelancing on a side (commiting to it around 30hrs a week after my day job). What scares me the most is all those details apart from programming. Lets say, I ...
-2
votes
0answers
39 views

Learning servlets and JSP help needed [on hold]

As I just learnt the basics of Java, now I am Learning Servlets and JSP . First of all, I already installed Apache Tomcat in Eclipse and it is already set up.Secondly I have I am currently reading the ...
3
votes
1answer
102 views

Retry design for high volume

I have a Java system using ActiveMQ for messaging. And the system processes about 400 to 600 transactions a second and we have no issue when everything is running smoothly. The system also got to send ...
0
votes
1answer
44 views

Pattern for separating UI code from logic in Wicket

I'm using Apache Wicket for developing web apps, I have developed a few for the last year and it has been great; today I was looking at a few pages and most of them look like this: public class ...
0
votes
0answers
27 views

Enforce coding decision to include or exclude an Enum element in an EnumSet at compile time

I would like to enforce that the elements of a Java Enum are chosen or excluded from an EnumSet at compile time i.e. I am forced to make the decision to put it in the set or not whenever I create a ...
0
votes
0answers
62 views

Design pattern for large data handling and transport in Java [closed]

Need to find best design pattern to implement the following: There's a queue of multiple Object A. Each Object A needs to be updated/modified by multiple other Objects, let's say Object B and C. ...
-2
votes
0answers
53 views

What are the Pros and Cons of recursion over loops? [duplicate]

What can be said for the benefits and negatives of recursive functions over using a loop? For example. Is it just a matter of writing less code? Surely recursion has the potential to StackOverflow ...
1
vote
2answers
119 views

Is it a good idea to require passwords in offline applications?

I am developing an application which can install extension modules (plugins, if you will) from APT-style repositories hosted elsewhere. The plugins need not be signed (although the downloads are ...
1
vote
2answers
127 views

Smells in exception handling: how to separate between public and internal exceptions?

During the development of a small web API, we decided to separate internal exceptions from public exceptions. Public exceptions are HTTP exceptions, that translate into HTTP responses with proper ...
0
votes
0answers
21 views

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

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

Optimal data structure for binary data/Java

I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) ...
-1
votes
0answers
20 views

Data Type of file_get_contents of php in java [migrated]

I am trying to upload an image to the database with blob datatype. I use web-service method addProfilePic that store the blob data to the database with my Codeigniter project. I retrieve the image ...