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

15
votes
6answers
2k views

Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?

I asked this question on SO but was suggested to try here. So here it goes: My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page ...
1
vote
1answer
85 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 ...
12
votes
6answers
2k views

Homework for strong C++ developers learning Java [closed]

I'm tasked with teaching an accelerated university special topics course in Java for programmers with many years of experience in C/C++. What sort of medium-length (1-2 hours max) assignments would ...
-1
votes
0answers
19 views

sending data from device to remote server [migrated]

My application is passing two value from device to remote server but it work in when i tested in bluestack when I install in real device it show a message like "Unfortunately app has been stooped" so ...
0
votes
0answers
18 views

accelerometer code in class [migrated]

I'm writing an app that show accelerometer readings, I was able yesterday to write all the accelerometer code in the main activity and it works fine on emulator and my device. But today I was trying ...
-2
votes
0answers
20 views

generating best fit from 3d datapoints [on hold]

given N datapoints of point(x,y,z) how should I go about generating the best fit line for this dataset? Accuracy is more important than speed as the collection of best fit lines will be precomputed ...
-9
votes
0answers
30 views

Writing an application [on hold]

I have done a lot of experimenting with all sorts of programming languages and am wanting to create a desktop application that can send and receive messages as well as notifications, etc from ...
0
votes
0answers
34 views

Testing if any two given objects are equal [on hold]

As described in the title I want to write a code that can compare any given objects and check if they are equal. Here's a sample code: public static boolean equals(Object o1, Object o2) { if ...
2
votes
2answers
784 views

About insertion sort and especially why it's said that copy is much faster than swap?

From Lafore's "Data Structures and Algorithms in Java": (about insertion sort (which uses copy + shift instead of swap (used in bubble and selection sort))) However, a copy isn’t as time-consuming ...
18
votes
4answers
2k views

How much refactoring is acceptable? [duplicate]

I am currently in a project where one of my developer colleagues constantly refactors stuff on every ticket he's doing. We are using agile methodologies. I know that refactoring is a good thing to do ...
0
votes
2answers
479 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 ...
4
votes
3answers
444 views

How to conduct a 3 days training on current techniques like TDD and CI

I am tasked to conduct a training for an upcoming team of 20 Java developers for a new project. The project owner wants us to use state of the art development techniques like TDD and CI. The ...
4
votes
3answers
194 views

Automatic builders/chain setters for Java?

Consider that code: FancyClass c = new FancyClass(); s.setParameter(value); s.setParameter2(value2); //a lot of parameters It is really naive, so we can use a builder pattern: FancyClass c = new ...
27
votes
10answers
3k views

Is template “metaprogramming” in Java a good idea?

There is a source file in a rather large project with several functions that are extremely performance-sensitive (called millions of times per second). In fact, the previous maintainer decided to ...
-3
votes
0answers
23 views

How to use Multiple class in javascript function for testmonial? [on hold]

I Have Two Div I want Use this Class For Testmonial Show Please Tellme How I use 2 class in one Function.
-4
votes
0answers
25 views

Arrays List and loops [on hold]

I'm not really sure how I could arrange these two in code to combine them together. I start off with five groups of some amount of cards which I believe that I can use an arrays list. But then I have ...
1
vote
0answers
47 views

Simple REST API calls using Spring?

Okay I'm having a simple REST API that is now running. I also got a mobile app (Android) that would be ready for some network communication. But here is the thing: I now got a fancy API created with ...
18
votes
5answers
2k views

If Scala runs on the JVM, how can Scala do things that Java seemingly cannot? [duplicate]

I just learned about Scala yesterday, and I'd like to learn more about it. One thing that came to mind, however, from reading the Scala website is that if Scala runs on the JVM, then how is it ...
2
votes
1answer
169 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 ...
-3
votes
0answers
22 views

Matrices Developing using Java [on hold]

Okay hey guys, So am asked to develop a matrices program using Java the program have a class called Matrix represents matrix of the fraction Number(another class) the quastion is How To :The class ...
-4
votes
0answers
32 views

Foreign characters display like junk on the screen [on hold]

We want åäöÅÄÖ to work (for a custom cryptography) with Java. It seems that there is a problem whether åäöÅÄÖ are before Aa or after Zz. Which is it and which should it be? Am I mistaken that this has ...
0
votes
0answers
45 views

Lag problem for a simple game in Java on Linux [on hold]

I made a snake game in openjdk-7 on Linux(Ubuntu 14.04) but there is a lag problem with the game.The lag occurs in openjdk-7 on my computer but some of my friends tried the game in openjdk-7 on ...
-2
votes
1answer
44 views

InteliJ Git vs GitHub for Windows vs SourceTree [on hold]

So I'm a bit curious as to what is the best practice when using version control. I've been using SourceTree(w/ mercurial) at work but have used as well for my course assignments with (Git). I've also ...
0
votes
1answer
80 views

How to deliver messages from a communication interface to a core? [on hold]

I want to develop an application in near future, where I will receive data via a communication interface. So there exists a Java class, that is responsible for getting the data. After the application ...
17
votes
7answers
7k views

Is it a bad practice to have an interface to define constants?

I am writing a set of junit test classes in Java. There are several constants, for example strings that I will need in different test classes. I am thinking about an interface that defines them and ...
1
vote
1answer
238 views

Is this database design good? What JPA Entities should I create for this design?

I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below. Is this design good ? Any suggestions for improvement are ...
45
votes
8answers
5k views

Why a static main method in Java and C#, rather than a constructor?

I’m Looking for a definitive answer from a primary or secondary source for why (notably) Java and C# decided to have a static method as their entry point, rather than representing an application ...
-2
votes
0answers
11 views

Java SWING: JList holding multiple Components as a single item [migrated]

Here is my problem: I'm creating a window that is responsible for listing a layer, where it displays the layer's current image (in the form of a ImageIcon as of now), layer's name, and a checkbox to ...
-2
votes
0answers
23 views

Finding the sum of columns in a Two Dimensional Array with rows of different lengths [migrated]

So i'm having a bit of trouble with my code in returning the sum of the columns in a two dimensional array with rows of different lengths. For example a 2X2 array works perfectly to calculate the sum ...
0
votes
0answers
46 views

Using WiFi USB dongles or other technologies to send non-WiFi data wirelessley in Java [on hold]

I'm currently trying to figure out a good solution to make a new kind of peer to peer network. I need a hardware protocol (ie. USB, Ethernet, Wifi, etc.) that is easily accessible from Java, probably ...
-4
votes
0answers
22 views

The design and implementation of a programming language [on hold]

I study computing, I have to create a language in ANTLR 4 and the implementation should be a compiler or interpreter. Have anybody an idea what kind of language can I create????
-4
votes
0answers
13 views

Including trail period and paid version in the software [on hold]

I am have few questions about the software launch I have built my software using Java, and Converted it to .exe setup using Excelsior. I want to include trail period/paid version in my software, ...
1
vote
1answer
34 views

Keeping lists of Objects, some with, some without inheritance

Let's say I have two classes, Foo and ExtendedFoo where ExtendedFoo inherits from Foo. Foo has a method .getValue() which returns a number, ExtendedFoo also has .increaseValue() which adds to the ...
5
votes
1answer
263 views

Is it possible to use the Android layout system in a desktop java application?

I am lazy, thus, if possible, I would like to only have to design and program a UI once. If I want to create an App for Android and as a basic Java desktop application, is there a way to reuse the UI ...
44
votes
5answers
9k views

Why doesn't Java 8 include immutable collections?

The Java team has done a ton of great work removing barriers to functional programming in Java 8. In particular, the changes to the java.util Collections do a great job of chaining transformations ...
0
votes
1answer
93 views

Java front-end, PHP/MySQL back end methodology

I have been basically out of the programming world for about 10 years, with only a bit of dabbling here and there with small Java utilities and one large Access database I wrote for someone, and some ...
-2
votes
2answers
106 views

Is this a good game plan to become a fluent Java developer? [on hold]

I am an efficient person, and I am trying to find the best method of becoming a great Java developer. Here's what I'm thinking: First, learn syntax and Object Oriented concepts. Practice it, and ...
1
vote
0answers
64 views

Were Java and Flash necessary pre-cursors to JavaScript and HTML5? [on hold]

Java appeared in the Netscape browser in 1995, with Javascript and Flash very soon after (I think). Java and Flash allowed programmers to add rich interactions to otherwise static sites, which can now ...
9
votes
5answers
18k views

Best way to load application settings

A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this ...
4
votes
4answers
708 views

Should I edit a codebase's whitespace to conform to a coding style? [duplicate]

We have a large Java project (1m+ SLOC) with mixed whitespace - some files have tabs and some have spaces. It's tricky to make my editor work with whichever file I happen to be editing. We are ...
0
votes
0answers
27 views

Help with IDE features integrating with ant build scripts

I've been spoiled by relying on IDE generated scripts for a while. But for the project I'm on now I have to use, basically, custom ant build.xml scripts. This hasn't really been a problem. But I'm ...
-1
votes
0answers
64 views

When should inheritance NOT be used in a program design? [closed]

I have read into the debate on if inheritance should be used often or not and have found a few good points, but could some one present a good example of when inheritance should not be used?
1
vote
0answers
70 views

How to loop through array bidimensional in diagonal according to a position in degrees

The title could be no self-explanatory enough but I need some conceptual help in order to implement a solution to go through an array: I'm developing a program to calculate the "most shadepath" route ...
-2
votes
0answers
20 views

Can anyone tell me what will be the better for Http proxy [closed]

I have assignment based on computer networks I have to design a Http Proxy Server but I am confused that whether I should build it on java or C#. Please guide me and also explain why it is good ...
-4
votes
0answers
26 views

MAXIMO LDAP: refused to connect [closed]

MXSession session = MXSession.getNewSession(); String connHost = host + ":" + rmiPort + "/" + serverName; System.out.println("Connecting to " + connHost); session.setHost(connHost); ...
14
votes
5answers
1k views

Why does the TRACE level exists, and when should I use it rather than DEBUG?

In Log4J, Slf4J and a couple other logging frameworks in Java, you have two "developper" level for logging. DEBUG TRACE I understand what DEBUG do, because the explanation is clear. The ...
0
votes
1answer
96 views

Access fields of super class from derived classes [duplicate]

There is an abstract BaseGame class that will be inherited by specific game classes. This class has an attribute requestHandler that will be used in all subclasses and should be initialized in the ...
2
votes
0answers
51 views

Conventions for revision control with Maven/Jenkins

For a software project I am working on, we have a 'dev => QA => production' methodology. That is, we create a release candidate (deployed to Artifactory), give it to QA (deploy to QA systems and a QA ...
-3
votes
0answers
47 views

Finding the Longest Palindrome string from the first alphabets of random student names? [closed]

I have a problem in which I have a set of student names For example:A small set {'Alex','Boris','Zing','Nix','Chris'} etc. The first characters will be A,B,Z,N and C And the string generated by it ...
16
votes
8answers
1k views

How to spread awareness for generic programming among team members?

I am staying in an environment, where people believe: Java generics are the feature exclusively used for library writing and not for the real coding. C++ is an OO programming language; template is ...