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

4
votes
2answers
196 views

What are the key differences between Java's and Python's OOP support? [closed]

The only language I've ever used is Java. I like it a lot but decided it's time to learn another language :) . I'm interested in learning Python. It seems like a good choice because it's partly ...
-2
votes
0answers
28 views

JTree is Only Visible Part of the Time [migrated]

I am trying to populate a JTree from a SQLite data base. When it does show up, the JTree is populated correctly, but is only shows up about half the time. Why would it do this? public class ItemPane ...
5
votes
2answers
284 views

What's the easiest way to comply with open source licenses? [closed]

I'm really confused by all the open source licensing details like "I wrote a web application, which should run on a computer not owned by me. My software uses the library/language xxx. Is this ...
20
votes
2answers
1k views

Do modern languages still use parser generators?

I was researching about the gcc compiler suite on wikipedia here, when this came up: GCC started out using LALR parsers generated with Bison, but gradually switched to hand-written ...
0
votes
1answer
79 views

Confusion about instance in an interface

I'm trying to learn OGSi framework (Equinox distribution). I have registered my service, but I'm confused about a piece of code that I've copied: IAgendaService service = new AgendaService(); What ...
2
votes
2answers
189 views

What happens if I close an InputStream that is passed as an argument?

I have read that Java is pass-by-value, and I've been reading about it in this question at StackOverflow, but I'm still a bit confused, regarding the close() or shutdown() methods in various classes. ...
0
votes
1answer
69 views

Differences between Direct, Composition, Aggregation, and Temporary Association

I am looking to take my java certification very soon, and I have a question about the different types of associations described in the official oracle guide book. The book describes the 4 as the ...
-1
votes
4answers
128 views

Why can you have statefulness inside a static class in java?

I was playing around with Java today and I read about static inner classes. Why can you have 'statefulness' inside of a static inner class. For instance: class outerClass { static class ...
0
votes
3answers
126 views

Nested maps vs. combined keys

in the project I am currently working on we had three different types of prices depending on the age of the user (adult, child, etc...). So we had on the DB a table looking like this: PRICES type ...
0
votes
0answers
43 views

Confusing project dependencies

I have a project for my main application and some projects for modules that are used by this application. Following I will reduce it to the main project and one module project. Both projects share ...
-1
votes
1answer
56 views

Huge long addition overhead compared to Native call?

A run a simple test JDK 1.7.0_45 (Windows 7, 64bit): Test 1: long start = System.nanoTime(); for (int i=0; i < 1000000; i++) { System.currentTimeMillis(); } elapsed = ...
3
votes
1answer
101 views

If a dependency is not in the maven repository should I add it to source control?

One of the jar files that I use in my code is not in the maven repository(and yes I tried to avoid using it). I have installed it locally so when I build the project it gets picked up by maven. I also ...
-3
votes
0answers
44 views

NewAer SDK how to start? [on hold]

There is an SDK called NewAer SDK. This will enable your devices to detect one another. Especially using Wifi/Bluetooth signal. But the question is, how to start? And where to start? I did sign up ...
2
votes
1answer
144 views

Builder pattern inside interface. Bad design decision?

I am having trouble evaluating an implementation of the builder pattern I just came up with. The context is an API library, so I am trying not to expose any implementations in order to have a stable ...
0
votes
0answers
17 views

Custom validator error messages with Struts 2 xml validation [migrated]

I am running into a wall on how to create custom error messages in struts 2. I iterate through a list of email addresses and validate using a custom validator. That validator will return true if any ...
0
votes
1answer
76 views

software design for client/server, over sockets, with JDBC [closed]

What's a reasonable architecture and design for a client/server application, over sockets, using JDBC? Right now I have the server query the database and instantiate a Queue of records. Clients may ...
-4
votes
0answers
47 views

Proximity SDK alternatives for Android [on hold]

Perhaps you used Wifi using Android SDK to get the device recognition each other. Or perhaps you used bluetooth for that purpose as well. But do you know that I found these two SDK(s) that provide the ...
0
votes
0answers
32 views

Why is my JFrame not visible when running my Java application in eclipse? [migrated]

Hi there and thanks for having a look at my question. I'm facing the following problem when developing swing applications in Eclipse: When I try to start a simple swing JFrame application (for example ...
0
votes
0answers
77 views

Interactive session with a command line program using Java?

I plan to write a website frontend for a free computer algebra system (Reduce, http://reduce-algebra.com/). On the webserver I have a Java virtual machine running, and Reduce is also installed. I can ...
39
votes
9answers
4k views

Programming for future use of interfaces

I have a colleague sitting next to me who designed an interface like this: public interface IEventGetter { public List<FooType> getFooList(String fooName, Date start, Date end) ...
0
votes
1answer
129 views

Why does this method return 2 values if I only ask for one and there is no sort of conditional statement anywhere?

I'm writing this very simple program from this one PDF called Think AP Java, and I can't seem to wrap my head around this: When I write public static double method_1(double x) { double ...
1
vote
1answer
107 views

How Jetbrain Phpstorm IDE is working without installed java?

As far as I know Jetbrains PHPStorm is programmed in Java but while I don't have Java installed in my Windows 7 PC, PHPstorm is installed and working without any problem. How It's done?
0
votes
2answers
228 views

how to approach pharmacy software project [closed]

I would like to complete a pharmacy software proof concept. But I have a few questions I do not know. Physician information In order to refill or dispense a new RX the software needs to have access ...
0
votes
2answers
90 views

Way for java program to read file from when it was stopped

I am working on an application that reads a log file, looks for a specific string, sends alert emails and saves data from the file into a database. The reading functionality is working well, but I am ...
0
votes
1answer
78 views

How can I perform a logical test to ensure that MY CUSTOM ERROR gets thrown instead of the NumberFormatException?

I am working on something that should be fairly simple. I have 95% of my program working, but one piece is still not fulfilling the requirement. (FYI, this is for a homework assignment, but I will ...
3
votes
2answers
140 views

Program Design clearness vs convenience

I've recently disputed with my colleague about the following situation: I've developed a framework that processes the resources (in java, although its not really important). It goes (simplified, ...
4
votes
3answers
80 views

Returning results of method on batch list?

The title is a bit vague so I'll try to elaborate. I have a function makeFoo(int bar) -> returns Foo or throws Exception. I also have a batch version of this makeFoos(int[] bars) -> ...
0
votes
3answers
167 views

When to use default access modifier?

I want to understand, from design point of view, in what situations I should use default access modifier, and when I shouldn't. I found this related question, that provides some basic explanations, ...
0
votes
1answer
84 views

Multilayered enterprise application use of JAXB objects

I am asked to refactor and maintain an enterprise application. Normally I'm used to using the MVC design pattern. This time however, I'd like to separate everything into layers (multilayered ...
-1
votes
0answers
47 views

Android Set Device DIscoverable (bluetooth) without any dialog [migrated]

How can I set the dialog to be hidden / suppress it to Yes when I try to execute the following code below? discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); ...
1
vote
2answers
237 views

Is it okay if we use an arbitrary string as UUID?

I found the tutorial of client (android) and server (pc) bluetooth tutorial from here. But my question is about the UUID. Is that okay if we define it randomly without the proper format? Because I ...
0
votes
1answer
80 views

Automatically create or update object in database

I have a database class with the following interface: public Database { //returns false if p (its ID) is already available //otherwise adds p the the list and returns true public boolean ...
4
votes
2answers
176 views

Understanding JAVA generic keyword 'super'

Recently some people said that I was wrong when I explained why one cannot insert a Number object into a list declared as List<? super RationalNumber>. (This assumes that RationalNumber is a ...
-1
votes
1answer
52 views

Is any one of these the right way to write a license for your opensource project forked and modified from an existing one with different authors?

I've used parts of source from an existing Java library project with what appears to be a 3-clause BSD license. I've made significant changes to the library which makes it possible to use it in a new ...
3
votes
2answers
101 views

System state design composition

Consider the following Java code: public class HumanStateImpl implements HumanState { private boolean alive; private Color skinColor; // getters and setters, other state fields ...
0
votes
0answers
26 views

Remote limitations of hg4j?

I’m evaluating hg4j to see if it’s useable in my current project. I need a (preferably) pure Java hg library that can: Check out a working copy of a remote hg repo at, say, ...
1
vote
1answer
94 views

Pros and cons of custom exceptions [duplicate]

This may be an pointless question based on opinion, style, and context but I've been racking my brain trying to decide whether or not to make use of custom exceptions and would love to hear some pros ...
3
votes
2answers
689 views

Why does C# have much more features than Java? [closed]

Please note that this isn't meant to be a Java vs. C# argument. I'm a Java programmer with no C# experience, asking just out of curiosity. I did some reading on C#, and it seems it has much more ...
1
vote
1answer
124 views

How to design extension mechanism for java app

I have an application where I have a set of core features. The application itself HAS to work in core only mode. I would also want to make the application extensible such that, when certain ...
0
votes
0answers
8 views

Select design pattern - user stage [duplicate]

I'm struggling to point a finger into the right design pattern. I have a web site which user can register and interact with the system. I want to add the following abilities to a user: Each user ...
2
votes
3answers
171 views

In Java, what are some good ways to separate APIs from implementation of *entire projects*?

Imagine you have a software module, which is a plugin to some program (similar to Eclipse) and you want it to have an API which other plugins can call. Your plugin is not freely available, so you want ...
-1
votes
1answer
71 views

What is the recommended way to go about porting large code bases? [closed]

I am currently porting a large library (150+ files, 15k+ LOC) from Javascript to Java. Fortunately, the original library is already very object-oriented, so this has largely been a matter of ...
0
votes
0answers
3 views

What method call in HttpsURLConnection actually sends the HTTP request? [migrated]

I am new to the HttpsURLConnection class in java, and looked on the doc and found it not very enlightening. I have inherited this code on a project I am working on (I did not write it myself) and ...
0
votes
0answers
15 views

Best approach for storing banking information [migrated]

I am currently developing an auction desktop application. At the moment I am storing the buyer and vendor information in 2 separate tables within a MySQL Database. Currently the data for these tables ...
17
votes
4answers
554 views

How bad is it calling println() often than concatenating strings together and calling it once?

I know output to the console is a costly operation. In the interest of code readability sometimes it is nice to call a function to output text twice, rather than having a long string of text as an ...
3
votes
0answers
75 views

Does synchronization in java protect modified class fields? [migrated]

I saw this on Java's synchronization tutorial: public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public synchronized void ...
-2
votes
0answers
24 views

how to read and write a ppm in Java [migrated]

I'm solving old exams. In Java, I would like to open an image file input.ppm, convert it to greyscale, and save it as output.ppm. So I have to read all its contents (RGB information for each pixel), ...
2
votes
1answer
144 views

Structuring a storage system for a game

I am working on a multiplayer game, where a player has many storages to store items in. Storage Storage is the system that allows the user to deposit items, and take them back. Example of storage ...
0
votes
1answer
129 views

Dynamic query in Mysql

I'm doing a J2EE web application with Struts2, Mybatis and a MySQL database, so what I want to allow to the user is to be free to choose different parameters to perform a select to a table in the ...
1
vote
3answers
145 views

w3c library license: does it prevent the inclusion in/distribution with paid software?

From W3C Software Notice and License: Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is ...