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

-5
votes
0answers
42 views

My poker hand evaluator is faulty - Java [on hold]

I have a program that can deal and compare poker hands which is a basis for a larger project. However it seems to incorrectly evaluate the best hand when high cards are concerned. I think this because ...
5
votes
1answer
140 views

When was Java's 'qualified this' introduced?

I've only recently learned about the qualified this, and was curious as to when was it introduced in the language, as I've been using Java here and there for around 18 years. Oracle keeps only the ...
-2
votes
4answers
174 views

How can the containsKey() method of a Java Hash Table be O(1)?

I had a very large ArrayList in Java, and I often need to check if it contains a particular value. This has proven very slow. Then I discovered that you can use a data structure based on a Hash. ...
-1
votes
0answers
23 views

MAVLink communication with the Pixhawk flight controller

I am attempting to achieve indoor autonomous flight with a hexacopter using only MAVLink messages (sent over 3DR Radio Telemetry) from a ground control station on my laptop that is written in JAVA. I ...
0
votes
1answer
101 views

Runtime vs Engine [on hold]

The Java Runtime. The Apache Camel Mediation Engine. Throughout computing I see "runtime" and "engine" used a lot, and seemingly interchangeably. But I can find no actual definition of these or ...
0
votes
0answers
14 views

Application settings/configuration storage-Preferences over Configuration file? [duplicate]

Is there any advantage over any of these? I have application that reads its initial configuration from Preferences rather then creating and writing into configuration file somewhere in users ...
20
votes
6answers
2k views

Should a method be forgiving with the arguments that are passed in? [on hold]

Suppose we have a method foo(String bar) that only operates on strings that meet certain criteria; for example, it must be lowercase, must not be empty or have only whitespace, and must match the ...
-3
votes
0answers
24 views

Method passing integer value not responding for java GUI [on hold]

I am doing two separate program, one is call MyNoteCenter and the other one is call SocketServer In MyNoteCenter, there consist of this portion of program if(e.getSource()== btn2) { ...
1
vote
2answers
145 views

Why Java does not have a framework like Rails? [on hold]

I am a Ruby on Rails developer and I like its simplicity and rapidness. On the other hand we need to use Java for some projects that we develop for our clients. My question is why (pure) Java does ...
-2
votes
0answers
21 views

RESTful web service in Jersey [migrated]

Im creating a RESTful web service through Jersey. I followed the guide http://javapapers.com/java/restful-web-services-with-java-jax-rs-using-jersey I created the web service as mentioned in the ...
0
votes
1answer
59 views

Why are Strings in StringPool considered insecure?

Passwords are recommended to be stored in char[] instead of String, as Strings are stored in StringPool. Read more here As per this question Strings in StringPool are not available directly. To ...
0
votes
1answer
56 views

Is Glassfish Or TomEE better than plain Java Web Container? [on hold]

I am trying to migrate my plain Apache Tomcat 7.0 Server to Glassfish or TomEE, but I'm hesitating to decide because I'm afraid it can cause a performance impact. In plain Apache Tomcat I can ...
-3
votes
0answers
113 views

how can i store floating point numbers in integer type variables e.g: 24.49

how can I store a number before decimal into integer or after decimal into integer example: float=24.49 it should print like this: int a=24; int b=49; what can be the logic behind this??
-2
votes
2answers
171 views

How 'Encapsulation' is different from 'Data abstraction'? [on hold]

class DblyLinkList below, follows these 2 definitions mentioned in this answer. Term representation is used in in place of implementation in the code. Abstraction has to do with separating ...
1
vote
1answer
36 views

Database + Java Design for a scenario

Overview A central web application to supports other web applications(A) for user and its role/permission management. Applications (A) call the central application via API to get the user ...
-1
votes
0answers
57 views

Writing html via Java

I have some information stored on my computer in text files. I use Java to manipulate, format, and process this data. I would like to write a program in Java that will result in the data appearing on ...
1
vote
1answer
102 views

Is it possible to build up a “stack trace” from the code (using some tool) in Java [on hold]

To analyse workflows in a bigger environment I usually spend a fair amount of time walking through code by using "go to implementation" or "find usages" lookups. But after 4 or 5 jumps its sometimes ...
-1
votes
0answers
14 views

register action working very fine but there is a problem in login that it couldn't find its corresponding result [on hold]

LoginAction--- package actions; import java.util.Date; import java.util.Map; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionContext; import dao.UserDao; public ...
-4
votes
0answers
37 views

i am trying to print age, height and name using the concept of multiple constructor is java but something is wrong. can anyone help me please? [on hold]

// this is my timePractice class package timepractice; public class TimePractice { public static void main(String[] args) { timeRegular obj = new timeRegular(); obj.setAge(20); ...
0
votes
1answer
86 views

Immutable class with behavior

I've just finished Effective Java and I loved it. I'm trying to refactor one of my programs to take advantage of what I've learned, and I have a lot of questions regarding immutability. My program is ...
0
votes
0answers
35 views

Better Approach for retrieving multiple RESTful calls

I have an Android application that associates bluetooth beacons with data that is retrieved from a server via RESTful calls. Once the app is launched, we have a page with a table that is being filled ...
1
vote
0answers
59 views

Separate GUI for clients

I am writing a game in which I have a Java server/client system set up. Everything is working great, but I reached a slight problem. I have set up a basic health system, and a GUI to go with it (for ...
1
vote
1answer
38 views

Is it appropriate to pass in a derivative to calculate the error of a Neural Net?

I'm reading a guide for back-propagation of a neural net, and it gives the error function as: Next work out the error for neuron B. The error is What you want – What you actually get, in other ...
1
vote
0answers
70 views

The same objects are staying in memory across multiple executions

I was testing a neural net I created, and noticed something odd. The net uses a hashed adjacency list (roughly) to maintain its links. The vertices of the list are the nodes of the net. I chose to ...
2
votes
2answers
87 views

When should I instantiate a variable rather than grabbing it through a method?

This may be tedious, but I would love to know which is a more efficient way of programming. The result may only be slightly better or slightly worse, but I am still interested in which is 'better'. ...
-4
votes
0answers
40 views

Difference between == and .equals (java) [closed]

I store my game map as Tile tiles[][] array For singleplayer game in render fuction I can use if (map.data[x][y].group =="crappyblocks") {do ......} Group is a string. I started making basic ...
-1
votes
1answer
108 views

Carriage return not working properly in eclipse [closed]

Carriage return is not working when i execute the program it produces the n number of characters after "\r" in a newline class NewClass{ public static void main(String args[]){ String str = "Hey ...
4
votes
1answer
118 views

Why does Java define BigInteger / BigDecimal values of 10?

Question perhaps slightly left of field - but I'm curious as to the logic behind why Java's BigInteger/BigDecimal classes feel the need to define a constant of TEN? Example taken from ...
1
vote
2answers
111 views

Could changing the return type from void to string introduce breaking changes?

This SDK have an interface like this: public interface Contract { void update(..); void action(..); void delete(..); } Now, we need to change it to something like this: public ...
-3
votes
0answers
28 views

What is the dereferenced in switch block? [closed]

I executed the following code and I got the following errors. RunUnitConvert.java import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import ...
0
votes
0answers
33 views

How should I go about making a statistics analyser? [closed]

I'm making a program which should analyse the stats of all soccer premier league players in fantasy football (form, price, fixtures, injuries etc) and using those stats, predict point potential/value ...
0
votes
3answers
93 views

Implementing a Generic List in Java

In an effort to understand Generics in Java (and how to use them), I am trying to implement a list structure using them but have hit a wall. Scenario: Suppose there is some classes (we'll call them ...
0
votes
2answers
143 views

Design Patterns: What design pattern should I use for the following? [duplicate]

I am trying to write an utility which traverses through a list of files and searches for a string in each file. On finding the string in a file, I will add it to a list and display the list. Which ...
2
votes
1answer
128 views

Good Coding practice with respect to interface versus class versus super class

I am currently reading the following tutorial and have gotten up through here http://docs.oracle.com/javase/tutorial/java/concepts/interface.html Maybe I should not be thinking about this question ...
-5
votes
0answers
42 views

Windows custom lockscreen program [closed]

I'd like to create a windows application that locks my screen, I want the program to have the same functionality as this program but I want to add functionality to it so I can play custom sounds and ...
0
votes
0answers
79 views

Is it possible to miss a connection?

I'm writing a simple asynchronous tcp server & client program and I am curious if it's possible that the method "waitForConnections" misses a connection because it's still busy with accepting the ...
-6
votes
0answers
50 views

Auto Moving Objects using Java [closed]

Hi guys i am new to this field, but i am willing to learn java. So i have chosen games to learn java i am developing a game called Shooter, which requires images to move in its own...... So someone ...
3
votes
4answers
133 views

Design strategy for wrapping exceptions

I'm implementing a type of Repository for a framework/library that has (roughly) the following: public interface FooRepository { boolean contains(String id); Foo fetch(String id); void ...
-1
votes
0answers
31 views

Queries regarding getting a job as a software developer [closed]

I'm Computer Science Fresher and is looking for a good job in software devlopment. I know topics like Core Java, C++, data structures, SQL etc. I have following queries - 1) Should I learn ...
-2
votes
0answers
13 views

java.util.ConcurrentModificationException while removing items from collection [migrated]

I am learning Java's Collection framework. I wrote this little program to check why we can't use For-each to remove elements. Code: import java.util.ArrayList; class intro{ public static void ...
0
votes
2answers
186 views

Java difference between String a = null and String a = new String()

It a pretty naive question to ask but I got this doubt while programming for android. I use to initialize my new strings like String a=null, so in my code there remains a probability to get ...
30
votes
6answers
4k views

Is throwing new RuntimeExceptions in unreachable code a bad style?

I was assigned to maintain an application written some time ago by more skilled developers. I came across this piece of code: public Configuration retrieveUserMailConfiguration(Long id) throws ...
3
votes
3answers
203 views

Is enum order sensitivity an antipattern?

Is it an anti-pattern to depend on a particular order of an enum's instance declarations? For example, consider: public enum CompassPoint { North, East, South, West; } These points ...
1
vote
0answers
46 views

How to design an interface for two similar but distinct objects

I'm designing an API for a JavaFX control to be submitted to the ControlsFX library. This control is called the ViewManager, and its purpose is to hold a collection of View instances, all of which ...
2
votes
1answer
70 views

Define an object with the interface as a type instead of class name [duplicate]

I try to practice with the design patterns and explore one of the possible implementations of the Observer Design Pattern in Java. I paid attention, that in this example the object is defined with the ...
0
votes
0answers
15 views

Database search results by deviation from query in Java

When every i try something new, I always 'throw myself in the deep end'. I'm in the initial stages of an android app build (my first android app, and first attempt at anything java) I want to know ...
1
vote
0answers
18 views

How to get and save Wordpress content (html, css, images, videos) from a Java program? [migrated]

I apologize if it's not the good place to ask this question. Please if it's not help me to find where I have to ask it. So here is my challenge. I need to get and save Wordpress content (html, css, ...
1
vote
0answers
56 views

Simulating fluid transfer in a pipe [closed]

I know this is a fairly large/broad category, but I've been racking my brain over the last few weeks on how to simulate fluid flowing through pipes. In the environment I'm working, I can have a single ...
6
votes
1answer
80 views

Optional features: default method or separated interface

Dedicated interfaces seems to be a good way to expose the optional features in a domain-specific type hierarchy. However, they impede the use of decorator and composite patterns, which is also common ...
0
votes
1answer
107 views

If everything is supposed to be an object in Java (barring primative types), isn't this contradicting the point of static? [duplicate]

I often write code which makes an object and then use static methods in static classes to manipulate said object. Am I missing the point of OOP? How do I know whether I'm thinking in the OOP mind ...