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
1answer
54 views

Synchronize or catch an exception?

I was given a project in which there are lines like Object item = null; try { item = mShowsAdapter.get(0); } catch ...
12
votes
2answers
808 views

Can an abstract class be instantiated?

abstract class A { public void disp() { System.out.print("Abstract"); } } public class B { public static void main(String args[]) { A object = new A(){ }; ...
1
vote
0answers
103 views

Why aren't Java Collections put in a dedicated package

Why do they just reside in java.util and not somewhere more specialized like java.collections or java.util.collections? It could contribute to mess up with different unrelated code. Couldn't it? Was ...
7
votes
5answers
248 views

When to use generics in interface design

I have some interfaces that I intend third-parties to implement in the future, and I provide a base implementation myself. I'll only be using a couple to show the example. Currently, they are defined ...
2
votes
0answers
39 views

Could Java import C++ classes from a library using JNA or JNI?

In past, I used JNI to access some winapi functions, however winapi is C and therefore just procedural. Now my plan is different and I need to know whether I'm going in the right direction. What I ...
-3
votes
1answer
38 views

Simple addition program [on hold]

I can't figure out why my program won't return the sum of the numbers I input it just returns "sum=" import java.util.Scanner; public class Integers2 { public static void main(String[] args) { ...
1
vote
0answers
37 views

Decoupled architecture in Android

I am building an app for Android that will have multiple data sources depending on who is using it. N-tier architecture with a repository pattern seems like the right way to go about this but I am ...
1
vote
1answer
109 views

How does Java's Scanner (System.in) input's buffering actually work?

Over the last days, I've being reading questions as the one that follows: "Why is my input code not working?" I myself had a couple times problems getting the input working right... as far as good, i ...
-3
votes
0answers
80 views

How to Calculate result of two Pictures [on hold]

Here is the one picture I want to fill out character of this picture After correctly fill out character of this picture the result is shown Now problem is the here how can I compare of this two ...
-3
votes
0answers
132 views

Does a static class have to be nested? [on hold]

I have this problem: "Create a static class in java. This static class must be separate from the class that contain the main function." Is this possible? I thought java only supported nested static ...
-1
votes
0answers
29 views

how to organize android activities to be related? [on hold]

I'm working alone on android Project , and this is my first complete android project , and there are many activities and more parts are related for each activity , I write each part (which is related ...
6
votes
2answers
2k views

Why do we need an instance of the Scanner Class to get an Input on Java?

Java is object oriented, but, why do we need to create an object from the Scanner Class to get input? Couldn't next() methods, for example, just be Static? C looks to me pretty simpler as you just ...
3
votes
6answers
542 views

Design decisions while porting a non object-oriented C program to Java

Background: My boss made a comment on porting a C program that acts as some a simulator that communicates with a remote process through sockets to Java. He didn't assign it to me, or to anyone for ...
0
votes
0answers
63 views

Make a program deactivate after time [duplicate]

What I am referring to is a free trial. I would like to have a program that runs to a user who downloads it just like normal. However, I want the program to deactivate and become useless after a ...
-1
votes
0answers
28 views

Optimal Persistance Solution in Java [on hold]

I've been working with Java and Spring for 2 years now. Before hand I work in PHP writing straight SQL, I would say I'm more SQL minded than ORM minded. I have struggled to really find a persistence ...
1
vote
0answers
35 views

Approaches to Modeling a Graph Database over the Google App Engine Datastore?

I want to model a graph database over the Google App Engine Datastore. I am currently working on creating a Link entity to model the concepts of link/edge/relationship to the graph of objects. I am ...
-3
votes
0answers
21 views

Mixing then printing arrays, but they all end up the same anyways? [migrated]

I'm making a sudoku game. I have an array (puzzle[][][]) containing nine other arrays (zone1[][]-zone9[][]), which each initially contain {{1,2,3},{4,5,6},{7,8,9}} (and they're assigned those values ...
0
votes
2answers
124 views

whats the relationship between integration testing, TDD and Agile methodology? [on hold]

I recently attended an interview and was asked whats the relationship between integration testing, TDD and Agile methodology? I am still puzzled how to answer the question !!
3
votes
1answer
133 views

Should a new type be created though it only wraps a single field?

Say I have an interface Species that's defined as public interface Species { String getId(); String getDescription(); } The question is simply this: Should I create different classes to ...
7
votes
4answers
851 views

Should Objects with lots of fields be broken up? [duplicate]

When I have an Object that has lots of fields is it better to have them all as fields or try to find logical groupings as their own Objects and make those the fields? I guess it comes down to which ...
5
votes
4answers
206 views

Is Java package level scope useful?

I understand the idea of package scope, and at times have even thought I wanted it. However, every time I set down with a serious intent to try using it I discovered it did not fit the needs I ...
2
votes
3answers
92 views

Responsibility of the small business logic: in a class or in a method? [on hold]

I have separated business logic to many small blocks. Each block can be coded in small number of lines. Where should I put the block code? [A] in a method, grouped in the class by some same feature ...
1
vote
3answers
129 views

How can I create an abstract parent class which uses data from an inherited class?

I'm getting my feet wet with Android app development and tying to find a good way to manage database interactions across multiple similar objects. My goal was to have a structure like: public ...
1
vote
0answers
56 views

Detecting surface faces of a huge 3D mesh/grid

I've written a module in my application that creates a mesh from existing coordinate and face data. The number of vertices in the mesh could easily exceed 10 million and the same goes for the faces. ...
-1
votes
0answers
53 views

Backpropagation in layman terms [closed]

I've been studying neural networks, and I'm beginning to understand the basics. I know what the backpropagation algorithm does. It feeds sample input and calculates an error against a given output. ...
1
vote
3answers
220 views

Would combining enums with static strings in java be sloppy?

Currently my team has a number of constants defined as static final strings. I want to be able to iterate over these strings as if they were an enum in one location, but everywhere else they are used ...
1
vote
1answer
86 views

What is the point of the dao layer? [closed]

With the current technologies which are pretty good (JPA, Hibernate, others), what is the point of the DAO layer? It's very rare for a project to switch its backend from one vendor to another, so it's ...
0
votes
0answers
17 views

How should one model an ExchangeService object (in ews-java-api) for sharing MS Exchange connections?

I am creating an application which uses ews-java-api to connect to an MS Exchange server. Once the connection is authenticated, the api dictates use of ExchangeService object for searching mailboxes, ...
-1
votes
0answers
18 views

Segmented file downloading potential gains vs excess overhead/problems

I'm writing a download manager, i want to get as much speed as i can from my downloads and I'm thinking about implementing segmented file downloading with conjunction to parallel download for each ...
2
votes
1answer
50 views

Android Pass Data between fragments

I have a question about passing data using bundle between fragments. I need to pass the URL from a Product object to the next fragment, so I don't know which is the best approach: to pass only the URL ...
0
votes
1answer
80 views

Collections.sort question

My question maybe related to this question - Encapsulating Internal Data Structure I have a class LCTile.java which contains a Coordinate.java class. Coordinate.java that contains latitude and ...
3
votes
2answers
181 views

Converting static utility class into singleton

In company where I work we have lots of "utility" classes, each has lots of code inside (thousands of lines), and they are all static. And one static methods call anothers. The problem here is that ...
-4
votes
1answer
148 views

Comparing the Java language to non-Java JVM languages [closed]

I was contemplating on the necessity of different non-Java languages coming up on the JVM. Apart from syntactic sugar and built-ins, does any of them actually exploit some corner of the JVM, which has ...
-1
votes
2answers
132 views

Modelling a parcel management application

Scenario/Context: I am working on an application which would find out the highest volume of parcel delivery based on the pin code of a particular area by reading a text file which has the list of ...
1
vote
1answer
99 views

Porting security from Java/.NET to PHP

This probably a rather naive question given my limited knowledge in the code I've been looking at, but I want to get my head around it before I start diving into writing actual code myself. I'm ...
4
votes
3answers
158 views

Track Bug fixes in code

I am working in a project in which at many point I need to change the code and fix the bug of the system but how can I inform other team members about this change? Usually I add single line comment to ...
-1
votes
0answers
105 views

What is abusing static? [duplicate]

Many people are always telling me not to abuse static in Java. What does that mean and why should it not be overused? The most recent case where I was told not to abuse static came when coding a ...
4
votes
1answer
91 views

How to load environment configuration

In Java the typical way of storing configuration is by using property files. So I have several such files, one for each environment type (dev, test, prod, ...). This configuration is needed in ...
0
votes
0answers
24 views

Android TranslateAnimation :: How to get the Speed of Mass Object

I'm currently having a project for making a springs-joint effect on android. And With two objects : A Mass Object A Springs (for hanging the mass object) And this link is my GIF animated of the ...
5
votes
4answers
283 views

Is using object of main class better than using static main method? [closed]

I have noticed in java programs at least, that people tend to prefer to start their programs by creating and instance of the class that contains the main method, and activating a non-static method ...
24
votes
7answers
2k views

Is there any practical way for a linked node structure to be immutable?

I decided to write a singly-linked list, and had the plan going in to make the internal linked node structure immutable. I ran into a snag though. Say I have the following linked nodes (from previous ...
1
vote
4answers
206 views

What are the differences between class variables and instance variables in Java? [closed]

I'm very new to Java and want to be difference between class variables and instance variables. For example: class Bicycle { int cadence = 0; int speed = 0; int gear = 1; } How are ...
0
votes
2answers
64 views

Implementing a component that provides interfaces in a component-based framework [closed]

I'm currently trying to develop a small white box component-based Android framework, but I have a doubt about which is the best way to implement my components and interfaces. An architecture of one of ...
1
vote
0answers
45 views

Shenandoah for OpenJDK? [closed]

I am very interested in the Shenandoah "pauseless" GC slated for the Oracle JDK in 2016 (Java 9 or 10 I presume?). Moreover, I'm wondering whether Shenandoah would eventually become incorporated with ...
1
vote
0answers
78 views

When is it justifiable to use pair programming and when is it not? [duplicate]

On the software project I'm working there are 4 teams of 6 people. The project itself is a moderately complex distributed system, but the current user stories are mostly about implementing CRUD ...
0
votes
0answers
67 views

Selenium Testing w/ dynamically generated element id's: XPATH or CSS selectors?

Background: I'm an intern tasked with learning Selenium; my organization plans on having QA/Testing use it to simplify testing. We use JSF and WebSphere Application Server. One of the persistent ...
9
votes
1answer
136 views

How to keep code examples in javadocs up to date

I'm working on a small library that provides implementations of basic, well known string metrics. Mostly for my own education. So development happens whenever I've got a bit of spare time. Because of ...
3
votes
3answers
282 views

'Encapsulation Vs Performance' trade-off in a lockable linked list

Main purpose of encapsulation is to protect in-variants of any class(in java). Here is the complete code for class DList/class lockDList/class DListNode/class LockDListNode. class DList and it's ...
1
vote
0answers
114 views

How do I set a final field via a setter? [migrated]

I have the following abbreviated class: public class Employee { private final float pointPosition; public Employee(float pointPosition) { this.pointPosition = pointPosition; } ...
-1
votes
0answers
18 views

Problems with storing plain text and byte information in the same file [migrated]

I am supposed to develop a subsystem to store certain business data in a file and I am running into a problem, but first some requirements I have: It has to be 1 file for the entire data. The data ...