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
0answers
220 views

Accuracy of “calculator algorithms”

I am building a library class that provides functionality for mathematical operations on BigDecimals (and a few on BigIntegers). Now, BigIntegers are quite easy to master and pleasant to use. ...
1
vote
1answer
56 views

Is JBPM the right tool for this? [on hold]

We have a utility for monitoring directories and taking actions when files appear in those directories. It's in java and takes the form of a standalone jar which launches several threads when started: ...
0
votes
3answers
148 views

Java Serialization for long-ish-term storage

I have an application that uses a database of about 15,000 Java objects, which I have to read every time the application starts. Originally I've been using JSON to store the data, but that has a few ...
0
votes
1answer
80 views

Is this an spurious wakeup or just a funky (non-spurious) race condition?

According to wikipedia: "The race conditions that cause spurious wakeups should be considered rare". But when I run this code, it is showing me that spurious wakeup happens quite often. Is this ...
-4
votes
0answers
28 views

JAVA - is there any tools that can view or monitoring LOG from running jar file? [on hold]

Good morning, please help, i have a problem as my question above, anyone can help?? I have using a tool like jlogviewer but it doesn't enough
5
votes
2answers
342 views

Why does java collections not supply a function for the index of max value?

I have been using Collections.max(list) for many projects, but I occasionally want to find the index of that maximum element. I feel silly writing a function to do this for myself in every program I ...
-5
votes
0answers
40 views

Getting java.lang.NullPointerException android [on hold]

I am making an quiz application in android in which there is Countdown timer of 20 sec for each question.when the timer finishes it moves to next question.i have added a next button which also moves ...
-3
votes
0answers
25 views

Anyway to easily have CROSS PLATFORM? for app? [on hold]

Suppose you write a program in a low level language(C/C++), can you run it anywhere? For example, lets say a game app written in low level language for android. Can it it easily be transported to iOS ...
-4
votes
0answers
84 views

Java language and why? [closed]

Why do programmers use Java to build a website instead of other languages?
0
votes
0answers
44 views

Abstract factory for web crawler [closed]

Here is my design for an abstract factory for web crawler. I have few web site that i want to crawl. Each site have different page version in each version of page , they will have the same product ...
4
votes
2answers
154 views

@SuppressWarnings in coding test submission

I am working on a coding test for an employer. It is not a particularly hard question but I am trying to do it as well and technically correctly as possible for obvious reasons. I ran into a problem ...
-2
votes
0answers
48 views

How many bytes is ideal for a page load? [closed]

I am doing some performance testing with jMeter on my application. I've check marked Retrieve all Embedded Resources and Clear cache on each iteration. I am getting some results which I don't think ...
3
votes
2answers
225 views

How does the JVM handle an exception thrown by the main method?

I understand exceptions, throwing them, handling them, and propagating them to a method lower in the call stack (i.e. throws). What I don't understand is this: public static void main(String[] args) ...
0
votes
2answers
119 views

Is there a way for Object 1 to call Object 2's enums in a function call?

For example, if I have two classes "Director" and "Follower". I want the Director to tell the follower where to go (ex: follower1.go(direction.LEFT)), and I want the Director to know what directions ...
1
vote
1answer
141 views

Divide and Conquer Algorithm clarification needed

I have a homework assignment for a data structure/algorithm class. The task is to take an unsorted array of size n (example: [-8, 3, 2, -3, 3, 1, -3, -5]), and we have to use a divide and conquer ...
0
votes
1answer
106 views

Act as MySQL server in Java/Android [on hold]

Is it possible to act as a MySQL server in a Java or Android application, such that applications like HeidiSQL can connect to it? What I want to do is to write an application for Android which ...
2
votes
1answer
122 views

Converting cron schedule to time intervals

I have, on the server, many jobs defined by users and some of those jobs are scheduled using cron expressions. I need to check (I can execute Groovy/Java on the server) if those jobs take longer than ...
0
votes
1answer
105 views

When should I refactor a private class into a package-private class?

When I began implementing a class in my system (let's call it A), I realized I needed some kind of object that does something. So I needed a new class (let's call it B), but I made it a private static ...
-1
votes
1answer
129 views

Is it common to have a constructor with 7 elements for example? [duplicate]

Is it common to have a constructor with 7 elements for example? or is it better to use many setters instead?
1
vote
1answer
100 views

Java Modal Object Design

This question is not about a specific program. This is about design - the UML phase of the project. I am supervising a Java project. It will contain a lot of modal popup dialogs. From a C/C++ ...
-1
votes
0answers
21 views

MVC Application Extension reusing the service / dao layers

I am about to start my own project spun off a greater Opensource project. I am trying to get my head around best practice, both in terms of application portability and stability. To explain: ...
-5
votes
0answers
28 views

how to remove threads in vector list container in java [closed]

Enumeration e = v1.elements(); while(e.hasMoreElements()){ Serverthread stm = (Serverthread)e.nextElement(); stm.send(str); } Enumeration ex=names.elements(); int ...
-4
votes
0answers
23 views

to implement connection pooling through jdbc using oracle databse,GETTING ERROR [closed]

import java.util.Hashtable; import javax.naming.*; import javax.naming.directory.*; public class OracleDataSourceRegisterJNDI { public static void main(String[] args) { try { // Set up ...
1
vote
1answer
253 views

When creating a library, is there a way to make certain classes entirely internal to the library, and not exposed to the user of the library? [duplicate]

Suppose you were designing a Java library for other people to use. You compile the library into a JAR that they can import into their projects and use. Needless to say, you intend for the library to ...
1
vote
4answers
377 views

How to work around Java's lack of pointers to pointers when working with linked data structures? [closed]

I've learned from a textbook how to implement binary search trees recursively in Java, and am working on implementing them nonrecursively. I've found a simple and elegant way to implement an insert ...
-7
votes
1answer
84 views

ArrayList stores only 64493 entries [closed]

I am reading from a file that has 128985 entries (simple English words list, LF delimited entries). I am using the below code to read from the file and store the words in an ArrayList. import ...
-2
votes
0answers
35 views

JOGL2 command line [migrated]

I have the latest version of Java and JOGL2 installed. After experimenting, I want to compile and run the most basic JOGL2 program possible. I have: import javax.media.opengl.awt.GLCanvas; public ...
-5
votes
2answers
98 views

Run java program without compiler or an IDE [closed]

I wanted to give a friend for Christmas a Java program to run. The person cannot program at all, so I would be surprised if he had any standard tools for programming. I know that there are some web ...
-3
votes
0answers
65 views

Unable to declare Java Constants as static [migrated]

I am getting error-"Illegal modifier for parameter DEFAULT_CATALOG, only final is permitted" in below (Bold part), Why I am not able to declare constant as static. Instead of directly using variable ...
0
votes
1answer
208 views

When should a class be final? [duplicate]

I've only really seen this on Java's wrapper classes (String, Integer, etc.), but never in open-source projects, and I was never taught about it in any books or classes. I know it means the class ...
-5
votes
0answers
39 views

Java socket file and chat program [closed]

I have write a chat program and a file transfer program. Both of these programs connects with Java Socket and I was just asking, can I combine those? Because when I was learning how to transfer file's ...
3
votes
2answers
260 views

Best approach for multilingual Java Enum

I'm running into issues with an approach I am taking and am now wondering if I just started down the wrong path and should rethink my approach. Here is what I attempting. I would like to use an Enum ...
1
vote
2answers
145 views

When I create an object, is fresh memory allocated to both instance fields and methods or only to instance fields

I have a following class class Student{ int rollNumber; int marks; public void setResult(int rollNumber, int marks){ this.rollNumber=rollNumber; this.marks=marks; } public void ...
-2
votes
1answer
95 views

JAX-RS and application wide business logic/resources. My brick wall has be found [closed]

I think I'm definitely hitting a brick-wall in understanding how to implement this. I would very much appreciate any assistance in this. All my JAX-RS links, Oracle, IBM and Stack overflow links ...
11
votes
4answers
665 views

Is it an overkill to wrap a collection in a simple class only for the sake of better readability?

I have the following map: Map<Double, List<SoundEvent>> soundEventCells = new HashMap<Double, List<SoundEvent>>(); This HashMap maps double values (which are points in time) ...
0
votes
0answers
98 views

Do thin fluent builder method chains have any need to be “extensible”?

In an environment where refactoring is difficult extensibility can be a life saver. However, this is no excuse to over engineer code. Given that a thin fluent builder method chain is backed by well ...
0
votes
2answers
86 views

How to connect Android App to MongoDB deployed on Google Cloud

Currently I am working on a simple app which will be able to connect to MongoDB which is deployed in Google Cloud. I have set it up MongoDB ocaly on my computer and I have made a little JAVA console ...
-1
votes
1answer
76 views

Naming of methods that perform some actions under some condition [closed]

I often write such methods to avoid duplication in code and I give them name such as doSomethingIfSomeCondition(). For example: public class TaskDownloadFile { private boolean started; ...
2
votes
3answers
126 views

Proper interface for calculator library?

As practice, I'm planning to implement a multivariable calculator library. The idea is that you can define a function, such as f(x, y) = sin(x)^2 + 3*y^3, and then you can evaluate it with specific ...
-3
votes
0answers
8 views

incorrect output for set input [migrated]

So I almost have this code correct but it's not giving me the correct output for some reason and I can't figure out why. This is what I have. That is what I have so far but I need the output to be ...
0
votes
2answers
231 views

Organizing code in a 2 man team

I've been working with a buddy of mine on a school project. We forecast it'll take ~2 months, so it isn't a small scale project at all. Communication and splitting the work effectively has been a ...
0
votes
0answers
42 views

Mixing newable and injectable in a Callable

I recently read http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/ which discussed newable vs injectable objects. What would you do if you needed to make a Callable that talks to some service ...
1
vote
1answer
158 views

Java Desktop Application Requirement - Is sockets the preferred choice ?

I'm currently working on a requirement for a desktop application - using Java If for some reason the GUI crashes, it shouldn't affect the background process. Once the GUI is restarted - the ...
0
votes
0answers
90 views

How far to go when future proofing fluent-method-chained-DSL test code?

Is it worth implementing interfaces, or using the getThis() trick, or even static factory methods to future proof against the need to extend this DSL? The current design is a pair of thin ...
3
votes
2answers
126 views

To subclass or to wrap for “default” implementation?

I'm creating a toolset in Java consisting of many Natural Language Processing (NLP) tools, such as Tokenizer, POS tagger, Lemmatizer, Sentence parsing, etc. I want to put all good and publicly ...
1
vote
0answers
76 views

How to efficiently handle related data in MVC?

Talking about MVC with servlets and JSP's, in a context about products and manufacturers , when querying the application for a list of products: the servlet loads a list of products from the ...
1
vote
1answer
151 views

Do you use static keyword to declare single instance pattern? [duplicate]

I just come across this code and find it interesting to know whether you consider this as another single instance pattern? public class Initiator { private static String str; // there is many ...
-2
votes
0answers
31 views

How to change the alignement of contains in a JScrollPane [migrated]

I am working on a GUI to manage bank accounts. I use a JPanel in a JFrame to list all the account register as buttons, and a JScrollPane to extend the view. When I run the program, the scroll bar ...
-2
votes
0answers
57 views

Auto generate project status reports thru email text analysis and summarization

I hate writing status reports for my boss. I usually spend an hour each Friday morning scanning emails trying to remember what the heck I did for the past week. A typical report looks something like ...
0
votes
0answers
49 views

Floating point number to binary

Which Algorithm does java uses to convert floating point number (Ex:0.15625) into binary(0.00101). Whether java uses normalized form or denormalized format ? If i type "float ab=0.15625" in java ...