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
votes
0answers
8 views

Change IntelliJ code construct symbols [migrated]

Is there a way to change the icons for symbols suchs the C for classes and the M methods. They're a little hard to distinguish on my laptop. Ideally I'd like to change it throughout the IDE but fine ...
0
votes
4answers
65 views

Adding values to HashMap

I want to add values to a HashMap, which would be used by methods in the same class. I have two solutions: Adding all the values with static When the first method is called, add the values ...
-6
votes
0answers
13 views

how to implement text classification in data mining [on hold]

I've been trying to implement a text classification system. It needs to read a text file, and extract the words and the word frequency. So far, I've been planning to parse the words, put them in a ...
-5
votes
0answers
21 views

Java swing component usage [on hold]

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public ...
-3
votes
0answers
32 views

Java and Windows Integration [on hold]

Looking to create an Open Source application that requires a moderate level of Windows Integration. I would like to make the system run on Linux in Java (Play Framework, Postgresql etc.) Windows ...
2
votes
4answers
106 views

Range of values based on key values

I'm trying to implement a method of searching trough a large amount of 2D points for those that match a certain range. I'm thinking of creating HashMaps for <X, Point> and <Y, Point> but ...
2
votes
1answer
82 views

How to access secure web services from a desktop application?

I'm writing a Java desktop application that will be available to the public. It will contact backend APIs via HTTPS using Jersey client. I don't know anything about using certificates in desktop apps ...
24
votes
9answers
3k views

What is different between the internal design of Java and C++ that lets C++ have multiple inheritance? [duplicate]

It's drilled into the newbie Java programmers that Java (pre-Java 8) has no multiple class inheritance, and only multiple interface inheritance, because otherwise you run into diamond inheritance ...
2
votes
3answers
158 views

Declaring lambdas in Java8

What would be the best practice to declare lambdas in Java8 code? How it was designed to be used? For example, let's say that we have a method that accept a Function. I want to provide function ...
0
votes
0answers
36 views

Java: Analyze audio from video [on hold]

I am in the process of writing a file management application for film projects. It will parse the video and look for the sound of the clapperboard. Once found, it will provide the user a frame from ...
-7
votes
0answers
62 views

I'm a Java developer planning to develop a software for my new medical shop. Which framework shall I use? [on hold]

I'm a Java developer setting up a medical shop @ my location , Since I'm a J2EE developer I'm planning to write a s/w to maintain my medical shop's daily transaction and stock maintenance and ...
0
votes
0answers
105 views

Java Ceil Weirdness [migrated]

Why does this output 0 instead of 1? System.out.println((int) (Math.ceil(1/2))); While this one correct outputs 1 System.out.println((int) (Math.ceil((double) 1/ (double) 2))); Shouldn't ...
0
votes
1answer
184 views

String[] args vs (String . . . args)

When programming for android, whenever I use an AsyncTask the doInBackground method looks like this. protected String doInBackground(String... args) But when using the arguments anywhere in that ...
-1
votes
0answers
62 views

Converting List of objects to an Array of Strings [migrated]

In my main class, I have: List<Person> allPeople = new ArrayList<>(); Then in the class I have a method which returns a String array of all the Id of people (Person has an accessor method ...
-7
votes
0answers
45 views

Anyone knows a simple generic cloud hosted UI framework with a dead simple Java API? [on hold]

The use case that I have is the following: Using her browser on a desktop or a mobile device, a user enters her credentials to authenticate (Any auth will do) the user is offered a simple dialog ...
7
votes
2answers
213 views

Efficient way to represent hexagonal board logic for abalone-like games

I have to implement the AI for Abalone game and I'm wondering what is the best way to represent the board logic using Java without wasting too much resources in all checks and updates routines ...
-1
votes
0answers
23 views

Testing an ID3 algorithm in JAVA [on hold]

I have just implemented an ID3 in JAVA. I followed the algorithm and I am printing the tree as rule conditions. However, I am still lost on how should I test the tree with (unseen) data. Should I ...
-1
votes
0answers
22 views

How does a panoramic app work? [closed]

I want to make a panoramic app(Android) but I'm not finding any tutorial on it. All I'm finding is a list of similar app available on Google Play. So can anyone explain me how it works in general. I ...
6
votes
3answers
227 views

Design solution for communicating between multiple layers

We are developing a framework that has several layers and would be deployed in a multi-threaded environment. Each layer may have its own input/output data type. The top layer takes the input, performs ...
1
vote
1answer
57 views

excute Vs excuteOnExecutor

There are two ways to execute AsynTask, i.e., execute and executeOnExecutor. I already know that execute works serially and executeOnExecutor works in parallel. So my question is: Which one to use? ...
-2
votes
1answer
41 views

Multiplayer in Android [closed]

I am developing an android game wherein four player will connect to each other, the player must be only be on the same LAN or Network. My problem is I really don't know where to start? Whenever I ...
0
votes
2answers
58 views

Design a Queuing Solution with Clustering and Multiple Consumers

It is a Design Problem which I am listing out here. I have different set of business operations that are carried out for different business entities. Operations: Operation A Operation B Operation ...
0
votes
2answers
56 views

JUnit3 and JUnit4 in the same project (but different module)?

I have an Android project with a Gradle build. We've decided to commit to writing a vanilla Java implementation of our business logic (since we took care to keep that divorced form the Android ...
-5
votes
0answers
70 views

How JIT is faster than that of interpreter in JVM? [closed]

Please describe above problem for the following given program. print a; print b; repeat the following 10 times by changing i values from 1 to 10; print a;
1
vote
2answers
105 views

Overriding methods by passing as argument the subclass object where the supertype is expected

I am just learning Java, and am not a practicing programmer. The book I am following says that when overriding a method, the argument types must be the same, but the return types can be ...
0
votes
1answer
42 views

Java Doc - Do fields also get documented?

This is a really simple question but oddly, I'm finding it difficult to get a definite answer.... What do you do with fields? Is this valid? /** * Keeps track of all usernames in the system. */ ...
0
votes
0answers
40 views

Best approach to save relationship mapping of country,state,city in orm

I am building a project in play framework java with jpa and I want set country,state,city dropdown fields in a form to be dynamic(from database).So only admin can increase or decrease the value of ...
0
votes
1answer
142 views

What'd be better? To add one more local variable, or to call a method twice in general case?

I have the method which returns java.util.Date inside the hibernate-entity class: package ua.com.winforce.loto_partner.commons.db.entity; @Entity @Table(schema = "pr", name = "publice") public class ...
2
votes
1answer
108 views

Object caching in this code too expensive?

I'm having some trouble with a game developed in Java which is kinda slow. I benchmarked it a little bit and found the problem: most of the time, the JVM is in the Object.<init>() since there ...
2
votes
2answers
192 views

Development on Android without using Java [on hold]

As the title of this question suggests, I am looking forward to develop app(s) on Android platform without using Java at all. It doesn't mean I have some kind of vendetta against this beautiful ...
0
votes
0answers
8 views

Incrementing a string [migrated]

How do I take an input and increment each letter by one e.g "ABC" to "BCD" in Java. I have attempted below to try and change the string to an int and then increase the value by 1. import ...
-4
votes
0answers
29 views

Is there a modern incarnation of the Java Web Start CD-Install page? [closed]

The Java Web Start Guide used to include a page describing how to make a Web Start application installable from external media, but that page isn't in recent versions of the documentation. Is an ...
-5
votes
0answers
17 views

Java writeLock() [closed]

How to determine if writeLock section is already busy? I mean I have multi-thrad application and many users use the same object. But only one users has an access for writing. Similiar code: ...
0
votes
0answers
24 views

Using a mock Spring bean

I m actually introducting to unit testing with Junit and I am wondering if I m doing the things right. In fact, I want to test a service in which I inject a repository (a Spring bean in my case with ...
0
votes
1answer
52 views

JSP without .jsp-files?

I have a little project (a CMS) that was developed using .jsp-files in 2006. I moved in 2011 to JSF and had only one .jsp-file for the frontend. In 2014 I integrated the backend into the frontend ...
-6
votes
0answers
62 views

Impact on changing UTF 8 to UTF 16 in a java web application [closed]

Will changing of encoding from UTF8 to UTF 16 in a java web app create a hole in its security ? Note: App uses Spring Security Saml Suite for SSO
-3
votes
0answers
21 views

JSP Web app to chrome app [closed]

i have a jsp web app with single function like kiosk app just single user at a time but now i want to make it or move it like a chrome full screen app. JSP app run on apache tomcat server locally
-1
votes
1answer
142 views

What's the returning a value in Java?

public void warning(){ System.out.println("Watch out!"); } public void warning(){ System.out.println("Watch out!"); return; } We must use "return" statement with void methods. Bot ...
-6
votes
0answers
27 views

Beginner's Java - Help Needed Using Eclipse! [migrated]

I have been busting my brain for days trying to complete this Java project and for the life of me I cannot get it to run. Here is what I am supposed to do: Write a program that calls each of the ...
0
votes
1answer
54 views

Reflection performance in this iteration of a (probably) large excel file

I'm wondering the performance of reflection in this situation. I'm iterating a (probably) large excel file (let's say 3000 max) which it's going to be done from time to time, and the implementation ...
-3
votes
0answers
92 views

Why does Java apply the concept of value pooling only to Strings?

Why are Strings the only type to benefit from pooling in Java? There are many data types the concept could be applied to. What makes the String type different from int, char, etc?
0
votes
2answers
37 views

Which 'InputStream' subtype is used by 'Socket' type object here?

In the below server socket program, byte stream object is used to read data from client, as mentioned - InputStream in = socket.getInputStream(); public class SingleThreadTCPServer{ ...
1
vote
1answer
44 views

Query on java I/O BufferedOutputStream write() method

Below is the code that is written using byte stream non-buffer class FileInputStream and FileOutputStream with the usage of explicit user buffers. public class FileCopyUserBuffer{ public static ...
0
votes
1answer
152 views

Shortest path to visit all nodes [duplicate]

I am given a set of tourist attractions(nodes identified by x, y) and i need to find the shortest path to visit them. The way i thought of it, is i will ignore if there are streets available and ...
3
votes
1answer
47 views

Template pattern with varying input type in overridden method

I am trying to use template pattern to define a generic algorithm in java. But the method that needs to be overridden, takes an object as input. This object will vary depending on the concrete ...
0
votes
1answer
123 views

Whats the difference between byte and Byte? [duplicate]

Alright so of course, I know the differences. byte is a primitive and Byte is an object. Byte offers more functions but there is one thing I dont understand. Why would anyone create a variable using ...
1
vote
1answer
152 views

Why is close() implemented in InputStream/OutputStream?

It make sense to see close() as non-core functionality of stream objects. This is the reason this method is placed in interface Closeable. One evidence is that class ByteArrayInputStream does not ...
1
vote
2answers
61 views

Query on hiding implementation details in java

With the below piece of thread related code, I see that author of Thread class is hiding the details about the working of start() method. What a user of Thread class need to know is, class Thread ...
0
votes
0answers
24 views

vert.x message bus architecture

A large part of the vert.x architecture is around the message bus, and message passing between verticals. The main idea I guess being that I can create multiple modules (possibly in multiple ...
-1
votes
2answers
78 views

Initialize in Field, Constructor, or Argument

If I know what a field will be initialized to, should I initialize it in the field, constructor, or receive it as a parameter? For example, where should I initialize an ArrayList? Initialized in ...