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

1
vote
3answers
308 views

Synchronization in the given Code

I had an interview few weeks back, and I was asked to write a code with Setters and Getters. I had written the following code; // Just an example Class ABC{ private int num; public void ...
2
votes
1answer
920 views

Is it worthwile to learn/use Play framework (for Scala or Java) if I don't use the MVC in it

I prefer Single Page Application to server side generated HTML. I am sensible to the pitch of "high productivity" delivered by Play. Now if I don't use the HTML generation part, is it still ...
3
votes
6answers
3k views

Should I be learning JavaScript before studying computer science? [closed]

So I've done a lot of research and found that Codecademy has been mentioned several times on other forums. I got stuck in and chose JavaScript through Codecademy most probably thinking it was 'Java' ...
3
votes
1answer
351 views

Question about Java nested classes design decision

I was shocked today to discover that this code compiles cleanly in Java: public class A { public static class B { private static void x() {} } private static class C { private /* So, ...
5
votes
3answers
2k views

How many threads should access the file system at the same time?

We have a module in an application which stores data in multiple files and multilevel directories and access them from multiple threads (both reads and writes). The directory structure is based on a ...
0
votes
2answers
2k views

Implementing MVC pattern in SWT application

I am developing an SWT application (it's basically an Eclipse plugin, so I need to use SWT). Currently my design is as follows: Model: In model, I have POJOs which represents the actual fields in ...
-5
votes
1answer
456 views

Why is an operating System denoted as 32 bit or 64 bit [closed]

Why are some operating systems labeled 32-bit and others 64-bit? If the processor is the one doing the actual execution, why does the operating system care about how many bits are used?
4
votes
2answers
436 views

Hide or Show singleton?

Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such: C#: MyClass.Instance Java: MyClass.getInstance() The question is: when writing APIs, ...
0
votes
1answer
1k views

Creating java package on ubuntu? [closed]

I am new to java. Here I am trying to create java package. And try to compile it from another directory . But there is an error like bash: /home/gaurav/Desktop/package2/B.java: Permission denied Here ...
3
votes
1answer
4k views

Multi-module web project with Spring and Maven

Assume we have a few projects, each containing some web resources (e.g., html pages). parent.pom +- web (war) +- web-plugin-1 (jar) +- web-plugin-2 (jar) ... Let's say web is the ...
-1
votes
2answers
354 views

Starting android Development [closed]

I am considering learning android development. I have some basic knowledge in C++. I downloaded the ADT plugin and eclipse. Now while starting from http://developers.android.com I see the codes were ...
0
votes
1answer
284 views

Algorithms for Data Redundancy and Failover for distributed storage system?

I'm building a distributed storage system that works with different storage sizes. For instance, my storage devices have sizes of 50GB, 70GB, 150GB, 250GB, 1000GB, 5 storage systems in one system. My ...
1
vote
2answers
1k views

How do I initialize a Scala map with more than 4 initial elements in Java?

For 4 or fewer elements, something like this works (or at least compiles): import scala.collection.immutable.Map; Map<String,String> HAI_MAP = new Map4<>("Hello", "World", ...
1
vote
2answers
1k views

Static vs. dynamic memory allocation - lots of constant objects, only small part of them used at runtime

Here are two options: Option 1: enum QuizCategory { CATEGORY_1(new MyCollection<Question>() .add(Question.QUESTION_A) .add(Question.QUESTION_B) ...
2
votes
4answers
4k views

Best alternative of Property file in Java

Hey I an working on the product which is live at multiple portals. The product is developed in GWT, JAVA, Hibernate. My question is : Whether there is any alternative of using property file in java. ...
16
votes
4answers
1k views

Documenting mathematical logic in code

Sometimes, although not often, I have to include math logic in my code. The concepts used are mostly very simple, but the resulting code is not - a lot of variables with unclear purpose, and some ...
0
votes
1answer
297 views

How to minimize the usage of static variables and objects

I'm trying to implement this JavaFX code where I want to call remote Java class and pass boolean flag: final CheckMenuItem toolbarSubMenuNavigation = new CheckMenuItem("Navigation"); ...
1
vote
0answers
690 views

How to Implement Complex Form Data?

I'm supposed to implement a relatively complex form that looks like follows, but has at least four more pages requiring the user to fill in all necessary information for the tracks: This data will ...
3
votes
2answers
20k views

What is the difference between Enterprise Java vs Core Java? [duplicate]

I have some experience in programming in Java but wondering if someone could explain what is the difference between Enterprise Java vs Core Java? Someone asked me a question on whether I use ...
3
votes
1answer
496 views

Push-Based Events in a Services Oriented Architecture

I have come to a point, in building a services oriented architecture (on top of Thrift), that I need to expose events and allow listeners. My initial thought was, "create an EventService" to handle ...
26
votes
3answers
2k views

Except garbage collector, what else makes Java a non real time programming language

Except the garbage collector, what are some other features in Java that make it unsuitable for real time programming? On the net, whenever Java vs C++ is discussed with regards to real time ...
2
votes
2answers
2k views

When to use inheritance or composition/aggregation?

In general, how do I decide whether to use make a class a super class, or to make it a private data member of another class? For example, given two classes, how does one decide whether to do this: ...
0
votes
2answers
150 views

Memento with optional state?

EDIT: As pointed out by Steve Evers and pdr, I am not correctly implementing the Memento pattern, my design is actually State pattern. Menu Program I built a console-based menu program with multiple ...
0
votes
2answers
125 views

Representation of data in application versus database [closed]

I'm going to make an application that will be given data to put in a database. The data will for the most part be the same, but the way it is formatted will vary a lot (could be in anything from text ...
10
votes
10answers
1k views

Any tools/suggestions on how to refute code coverage quality argument

Now I know people could consider this question duplicate or asked many times, in which case I would appreciate a link to relevant questions with answer to my question. I have been recently in ...
1
vote
1answer
171 views

How do I create a mutually-incompatible type library in Java?

Folks, this seems like it should be straightforward, but I'm drawing a blank here. As a simplified example, consider an abstract class called Number with an abstract method add(). I want to create ...
1
vote
4answers
3k views

Draw a checkerboard in Java

I'm reading through a programming book and am having trouble understanding a few parts of this code. The program draws a checkerboard, and colors the odd squares black. import acm.graphics.*; import ...
1
vote
2answers
994 views

What is the best way of storing date?

I am a new to storing dates based on time zones. Need to know the standard way to store the date in the datastore. My requirements are Easy to query the date based on the date range. show the ...
4
votes
1answer
1k views

Passing a Context around with dependency injection

In the project I'm working on, I'm using Guice and trying to do as much as possible with Dependency Injection. However, there's one little snag; many of my objects rely on an object Context. This is ...
-1
votes
1answer
122 views

Does Jar file shrinker affect performance

I've heard ProGuard's Jar shrinker affects the performance of you application. Is this true? And if so just how much slower does the Jar go shrinked compared to unshrinked?
8
votes
3answers
2k views

How to sync clocks over networking for game development?

I'm writing a game that has a lot of time based aspects. I use time to help estimate player positions when the network stalls and packets aren't going through (and the time between packet's being ...
-1
votes
1answer
276 views

Recompiling a java project while it is running

I have a Java program that takes about an hour to run. While it is running, if I change the source code and recompile it, will this affect the above run?
3
votes
3answers
2k views

Why doesn't Swing look native out of the box?

Java Swing GUI's don't look native by default (Except on Mac OS X for some reason). Swing uses it's own look and feel. You can get Swing to use the system look and feel by putting: ...
3
votes
3answers
161 views

Representational Equality versus Value Equality

I am coding a system where I have objects which represent a set of resources. These resources are identifiable (they have an ID). There can only be one resource with the same ID, and so multiple ...
2
votes
1answer
212 views

Mnemonic for always overriding equals when you override hashCode?

We java developers always know that you should always override equals() when you override hashCode(), but I consistently have trouble remembering this rule. What is a clever mnemonic to help Java ...
1
vote
2answers
377 views

if i have many calls of single method that returns field value, is it better to make a local variable?

In a method, i have calls of single method of another object that returns field value, like foo.value(), which is defined like Field value() {return this.value;} Is it better to make a local variable, ...
17
votes
3answers
3k views

How to solve the problem of nested comments

It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes ...
3
votes
3answers
2k views

articles in variable names and hard-coding strings

re-edited by author: no this is not 2 questions. This is one question about code review questions containing two separate points. Please do not edit my question. For naming variables, the two sides ...
7
votes
3answers
7k views

How is multi-threading different in a Java based Web Application vs Stand-alone Java Application

I am fairly new to Java and my experience is limited to Web Based Applications running on a Web Container (Jboss in my case). Am I correct in saying that for Web Applications the web container takes ...
4
votes
3answers
2k views

When should I use or not BooleanUtils.isTrue(…) and BooleanUtils.isFalse(…)? [closed]

About this function: org.apache.commons.lang3.BooleanUtils.isFalse(Boolean bool) and the similar isTrue, my co-work (less experienced) use it for every boolean in the code. I am trying to convince him ...
2
votes
1answer
4k views

High-Load Java Server for Multiplayer

I am making a multiplayer game. Now I am trying to choose the technology to connect the android devices to the server. The clients run on Android, and the game is MMORPG. I would like to write the ...
-1
votes
2answers
250 views

c#/java or c++ (Personal question) [closed]

First of all this is not a comparison between the languages. So I've asked a question before telling that I am a beginner programmer (hardest thing done is a chat server/client when I was reading ...
1
vote
1answer
803 views

Zen Coding for Java?

I just saw a demonstration of Zen Coding. I think it's a great investment on productivity, however my work is 99% backend data processing via Java. So far I only know templates in Eclipse like ...
0
votes
3answers
1k views

Best Way to Access Hardware per COM Serial Port over USB Adapter

We are starting a total new Branch at our firm. I am usually developing database interfaces or internal server/client applications/tools for our company, but I never had to do something with hardware. ...
2
votes
4answers
5k views

Keeping track of all objects of a class

I'm new to object-oriented programming, and I keep running into this issue. (I'm programming in Java) I've been a bit reluctant to ask about this, since it seems like such a basic issue, but I can't ...
4
votes
2answers
401 views

Dividing monopoly streets in groups

I'm new to object-oriented programming, to java, and to programming in general, and as my first real project I'm trying to program the board game Monopoly. What I've got so far is an array that can ...
2
votes
3answers
639 views

Easily add metrics to measure java code usability

I'm trying to create a process for better understand what's happening in my code. I want to create metrics to automatically give my answers about simple or complex questions like: How many times a ...
1
vote
2answers
262 views

GPL and OpenJDK: Questions regarding source headers

I have some legal questions regarding OpenJDKs source header: /* * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS ...
6
votes
2answers
1k views

Are you allowed to “copy” the GUI/Features of another application

I'm making a app which is based heavily on another application that serves a similar purpose. I'm not actually planning on selling it, but I'm wondering whether it would even be legal for me to sell ...
4
votes
1answer
827 views

Class design with bi-directional relationships

This is a purely design question. I want to port a nice educational "game" Bug Brain to Java. In this game you design neural networks which consist of three elements: neurons, nodes and synapses. ...