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

UML: do I use aggregation or composition in this case?

I would like to draw a UML sketch to communicate part of a software but the type of relationship between classes does not seem very clear cut to me. Let's say I want to periodically fetch the recent ...
2
votes
1answer
74 views

Should domain models instantiate other domain models?

I'm reading Domain-Driven Design at the moment and I'm trying to understand what should go in services and what should go in domain models. Say there is an application where you can reserve seats for ...
0
votes
3answers
296 views

Why do we call Java open source, when development or contributions are not decentralized

Open source software should be developed by different contributors in decentralized fashion. I understand that Open JDK is reference implementation of Java which is open source and it allows ...
0
votes
0answers
17 views

Are there special considerations to take for the database when using Hibernate's @Version?

We've encountered a bug which is solved by adding a @Version-ed field. However, I'd like to know if I need to add something special in the database (Oracle 11g), like adding some index on the new ...
0
votes
1answer
154 views

Recently moved from java to javascript on nodejs, how to maintain code? Help!

I recently moved from java to javascript on nodejs. I was very excited, opened up my intellji IDE for an existing nodejs project only to find I cannot know what the parameters I see functions ...
0
votes
0answers
12 views

JPA: Property/encapsulated objects instead of fields

I'm moving to JPA (JavaEE, Eclipselink) from a very large C# project. The classes were not using simple fields but Property objects. Example: //C# public class State : DataObject<State> //base ...
7
votes
2answers
260 views

What is an output argument, as refered to in Martin's Clean Code?

On page 45 of Robert C. Martin's Clean Code: A Handbook of Agile Software Craftsmanship, Martin writes that output arguments should be avoided. I'm having trouble understanding the meaning of "output ...
2
votes
7answers
547 views

C++ delete vs Java GC

Java garbage collection takes care of dead objects on the heap, but freezes the world sometimes. In C++ I have to call delete to dispose a created object at the end of it's life cycle. This delete ...
4
votes
2answers
176 views

The order of values in ? : expression

Which construction is more readable: someVariable == null ? SOME_VALUE : someVariable; // avoids negation someVariable != null ? someVariable : SOME_VALUE; // normal situation first I have to ...
-1
votes
0answers
38 views

Changing data in LVM format to CSV using Java?

So I need to take .lvm files -- which has a header and the data is separated by tabs -- and make them into .csv files with no header and data separated by commas. Am I able to do this using java? I ...
0
votes
0answers
12 views

JVM run-configuration launcher for production?

Does anyone know if there is such a thing as a run-configuration launcher for the JVM for "production"? Where you can set environment variables and arguments, just like in an IDE ?
-1
votes
0answers
59 views

Is it better still use Java\Spring MVC or a lighter technology as PHP\Laravel for a new project?

I am a Java EE developer that obtained the Spring Core certification (related to Spring Framework). In the last year I have gained experience with this framework. I am also pretty confident in the ...
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 ...
-2
votes
2answers
75 views

Interpreting JAVA code - crashes [closed]

Suppose the user enters 1 then 2 then 3 etc in response to prompts for as long as they can. Can someone help me write down the dialogue between the user and the code. Where does the crash occur? ...
0
votes
0answers
12 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 ...
0
votes
0answers
27 views

Spring security @PostAuthorize anotation don't work fine sometimes

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
69 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
297 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 ...
1
vote
1answer
73 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
121 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 ...
-2
votes
1answer
67 views

How to Translate MATLAB code to Java?

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
196 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
215 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
75 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
77 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
239 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
58 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
433 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 ...