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
2answers
79 views

Using Super.someMethod for added clarity?

Is Super.someMethod() a good practice to add clarity to the code by explicitly stating that someMethod is not a method included in the current class but in the parent class? For instance, would this ...
2
votes
2answers
116 views

Unit testing / How to validate private fields of a newly created object?

I have a basic unit test (for the sample) that involves this code: void testShouldCreateACar() { Car car = someone.createFerrari(); assertTrue(car.name == "Ferrari"); // can't access name since ...
0
votes
1answer
191 views

Java is not actually a pure object oriented programming language since it needs primitives Why?

here my Question it is said that "Java is not actually a pure object oriented programming language since it needs primitives" I want to know that how data types can affect to java be an pure object ...
-1
votes
0answers
13 views

Good Practice ADF Jdeveloper: Read Only View Obejcts and Write View Objects?

I just started to work with Java ADF and JDeveloper, I was wondering whether defining "Read Only" view objects and "Write" view objects is a good practice? I mean. Right now I can't find any scenario ...
-1
votes
0answers
30 views

Spring security @PostAuthorize anotation don't work fine sometimes [on hold]

I'm using Spring Security 4.1.0 for security of my java web application. I use @PostAuthorize annotation for get method as follow: Interface: @PreAuthorize("hasAuthority('get')") @PostAuthorize("...
-3
votes
0answers
23 views

Spring MVC OpenLDAP Authentication [closed]

I have made a Spring MVC user login Java application, but I want the user login to get authenticated using OpenLDAP ? Can someone explain the procedure ?
0
votes
1answer
70 views

strategy to display value for a html select

Strategy to display value for a html select I have a spring boot, application. On the client side, I use JQuery I would like to know the strategy to display "static value" for a html select. ...
1
vote
0answers
65 views

Should I annotate all the entry points in my library?

In a library project, I see numerous warnings suggesting that I reduce the visibility of public classes and methods. (Or in the case of methods I haven't written tests for, warnings about them being ...
0
votes
1answer
138 views

Isn't instantiating an object of type Interface illegal?

This answer describing how Spring for Java works instantiates an object of type Interface which is illegal yet it received 21 upvotes. Why is this answer upvoted for illegal behavior? Spring contains ...
2
votes
4answers
202 views

Must a variable contain an instance of a class if it invokes a method?

In the following link, the author states that We have already reasoned that ‘out’ is a static variable belonging to the class System. But now we can see that ‘out’ must be an instance of a class, ...
1
vote
0answers
55 views

Complexity of ArrayList and LinkedList

Suppose a Java method receives a List and reverses the order of the items it contains by removing each item from the front of the list, adding each item to a Stack, and then removing the items from ...
4
votes
3answers
298 views

Why instantiate and initialize an object without saving it into a variable?

Sorry if I got the wording wrong in my title, but it would be easiest to provide an example in JavaFX primaryStage.setScene(new Scene(grid, 300, 275)); Now from what I understand, this code is ...
0
votes
1answer
74 views

Android Studio, HTML and Java Correlation

I've recently started designing apps in Android Studio, and I've noticed that the same operations (for example, using a widget) can be completed by either going into the activityname_java file and ...
-2
votes
0answers
55 views

Are programming certifications a scam? [duplicate]

I've read a lot on the internet and other forums about programming certifications and their worth in filtering potential candidates for a particular job. The prevailing opinion on certifications is ...
1
vote
1answer
122 views

Design decision: class hierarchy or Java 8 Optional

I am really reconsidering my current class hierarchy for timeslots (in a schedule). I wanted to make them as flexible as possible so it would cover many possibilities of what we could understand as a ...
-3
votes
1answer
72 views

How to Translate MATLAB code to Java? [on hold]

How to translate the MATLAB code into Java? I've tried using the MATLAB library compiler, but the .jar file produced just cannot be executed though the type of the file is stated as "Executable Jar ...
1
vote
2answers
198 views

multi-threading performance when CPU is maxed out

I've noticed my software severely degrades when the # of threads is substantially increased. What I mean is that when I limit the # of threads, the performance is much better than when I just let ...
0
votes
3answers
138 views

Why do I want this class to extend an interface, and what is the right design pattern for this?

Suppose I have an interface Employee and there are many classes that implement it, such as Bob, Joe, and Mary, none of which may be changed. public interface Employee{ public void work() } public ...
0
votes
0answers
50 views

Background application which pops up a UI based on events

I need to code a Java Application which runs on the desktop. It's a continuously running application. It runs all the time. It should not show any UI unless there is an event. The application ...
5
votes
0answers
222 views

What lambda function optimizations, if any, are planned for Java 9 and beyond?

I'm working on a high-performance project where Java 8's lambda functions are enormously useful. I've found, however, that they're memory inefficient when used en masse. For example, suppose I need to ...
2
votes
1answer
216 views

Why are there no cross-platform mobile applications?

As a part of my master's thesis, I am carrying a research topic on why there are no cross platform mobile applications. As applications developed in Java can run on any operating system using the JVM,...
1
vote
1answer
77 views

Polymorphic constants in Java

I am designing some polymorphic code to perform mathematical operations. The idea is to abstract out the underlying representation of the data, as different use cases require different representations....
-1
votes
2answers
78 views

Connecting an HTML form to a Java program

I would like to create a front-end interface in HTML that interacts with a Java program via an HTML form. I would like to be able to publish this project on the Internet. In other words, the text ...
-1
votes
1answer
62 views

About data intensive and form intensive web applications

Can someone please highlight the definition and differences between data intensive and form intensive web applications.It would be really helpful if suitable java based web application framework or ...
0
votes
0answers
16 views

Layout for Java Multi window applciation

I need to get to know how to architect my an application with multiple windows. It has a dashboard kind home or main window with few icons(12 or more) on it. Clicking on an icon it will open a ...
3
votes
1answer
129 views

In Java, why is there no instance method like bigDecimal.isGreaterThan(otherBigDecimal)?

The current way of knowing if a BigDecimal is greater than another is bigDecimal.compareTo(otherBigDecimal) > 0 (or one.compareTo(another) == 1), but I find it too clunky and unexpressive. ...
-1
votes
0answers
24 views

Java / Android - openFileInput exception [closed]

i have the follwing code (a file chooser and a "fileToString" Method which doesn't work and i don't get the mistake. This is the code public void sdkarte(View v) { try { Intent intent = ...
2
votes
3answers
240 views

Why do assertions in Java need to get enabled?

I really like the concept of assertions in Java in the way how to use them. It's much easier than to write an if and then throw an Exception/Error. But the thing I don't understand is, why do they ...
3
votes
1answer
184 views

Why Generic type can not instantiated?

Here is my question. class Gen<T> { T ob; Gen() { ob = new T(); // Illegal!!! } } Why is it illegal? Could you please explain it.
1
vote
1answer
61 views

Best way to deliver and deploy JEE application to client

I've worked for a few companies and even developed projects on my own - these projects were based on Java Enterprise Edition. Sometimes with Spring Framework involved, sometimes it was a pure JEE. ...
0
votes
1answer
59 views

Designing a program that runs scrtipts on multiple computers(JAVA)

So Ive been trying to design a program in java(because I might need to create an app that does the controlling part) with GUI that can run scripts on a few local computers. It should do the following: ...
80
votes
9answers
7k views

Has / can anyone challenge Uncle Bob on his love of removing “useless braces”?

I hate referencing paywalled content, but this video shows exactly what I'm talking about. Precisely 12 minutes in Robert Martin looks at this: And says "One of my favorite things to do is getting ...
3
votes
2answers
80 views

RESTful service and DAO: deciding on responses

I am developing a RESTful API and I am using DAOs to serve data to the service. I am having trouble deciding where certain responsibilities should fall, whether in the service or in the DAO contract. ...
7
votes
3answers
440 views

Should a DAO be singleton or not?

I am developing a RESTful API and I think it is convenient to use DAOs for my resources because although I plan on just using memory to store them, I don't want to close a door to whoever is using my ...
-1
votes
1answer
137 views

How to allocate an Int32 number for a GUID string? [closed]

We want to allocate a Int32 value for a coming new GUID, which is not exist in our system. One solution is to use auto-incremental Id in Mysql, but it's not convenient for later usages. Another ...
5
votes
1answer
81 views

Designing a flexible API with support for Callbacks

I am writing a Java library that needs to make http GET && POST requests. There will be two types of users of this library: Those with understanding of callbacks and know how to use them. ...
5
votes
3answers
315 views

Is nesting try-catch statements still a code smell if nested within a loop?

I have heard that nesting try-catch statements can often be a code smell, so I'm wondering whether this situation is an exception. If not, what would be some good ways to refactor? My code looks like ...
0
votes
1answer
109 views

Is it wrong to call a “non-static nested class” an “inner class” in Java?

I was reading this question in SO, and it contains the following: A non-static nested class (sometimes incorrectly referred to as an 'inner class') (...) And it confused me. At 350+ upvotes, I ...
3
votes
2answers
220 views

How to cope with very similar projects

At our company, we maintain three products, which are quite similar, in 2 Projects. All Java, using Maven for dependencies. These three products evolved out of another project, which is now a maven ...
0
votes
2answers
45 views

Guava Multimap merging consecutive items with same key

I have been playing around with Guava Multimaps and I ran into an issue with tracking when an user is damaged (more the way it's displayed, really) Let's say I have a Multimap<User, Hit> and ...
0
votes
0answers
42 views

Should fragments register directly to an event bus or should only activites do so?

Please correct me if I'm wrong about any of the following. I understand that if a fragment wants to make a network call it tells it's activity then the activity makes the call and returns the answer ...
-1
votes
1answer
108 views

Using sessions with Jersey in a REST API

I am starting to develop a REST API with Jersey to retrieve a schedule for a given sport tournament. The client sends a JSON containing a tournament with its different categories, domain, definitions ...
0
votes
1answer
43 views

Building an API with one central connection object to an external device

I want to build an API (Java) that heavily relies on a connection object to a data server that manages a connection to a real device. All i have is a DeviceConnection object. Currently i have a big ...
-2
votes
1answer
91 views

Duplicate code to avoid performance decrease due to function calls? [closed]

I have a simple list in Java that I need to search using one of two methods. The first method simply returns the position in the list of the first matching element. The second filters out any elements ...
-1
votes
1answer
60 views

How do you deal with NULL values while creating jsonObject?

I am learning java and jsr-353. My question is quite forward. Having the method below: public JsonObject createJsonObject() { return Json.createObjectBuilder() .add("address", this....
1
vote
1answer
53 views

Parameter objects place holder?

If a method has too many parameters, the suggestion is to convert them into a parameter object. Where to place such parameter objects? in domain/entity classes package? or if I have a separate package ...
0
votes
0answers
22 views

Concept analysis: using a Java ServerSocket to let an Android phone and server communicate?

I have an idea for an application that will not be published to the public Play Store. My friends will need to be able to log in from their Android phone to view certain data that cannot be viewed by ...
-2
votes
2answers
88 views

Java Ellipses Signature for Multiple Parmeters

Firstly, I am studying function with new type of signature and body, and in this code, I want to know, what type of object is values? It doesn't appear to be an array of strings based on my ...
4
votes
4answers
238 views

JSON API or Plain JSON

There is a debate in my company on whether we should use the JSON API specification or stick to plain JSON for developing APIs that will be consumed by mobile apps, mainly iOS and Android. One ...
4
votes
1answer
197 views

Should use case/interactor `execute` method accept parameters

In most examples of clean architecture (Android projects mostly, though) I've noticed that the use-case/interactor classes (units that encapsulate a feature) often share base class/interface, like ...