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

-2
votes
0answers
12 views

Generate random numbers in java…! [on hold]

I'm writing a code for a command line game in which I want to shuffle numbers randomly. i created 3 different functions. Each function generates a number different from other. and those 3 functions ...
0
votes
2answers
400 views

Is factory pattern a right pattern for the situation described here?

Is factory pattern a right pattern when we want to consolidate the related objects? Problem - In the Set-top box, I have a user-io, basically the interface to control the settop box - The user-io can ...
-2
votes
0answers
14 views

Java Robot class highlighting text help [migrated]

I'm trying to write a program that copies text from TinyChat(https://tinychat.com) and copies it to the clip board. Eventually it will take everything said in chat and paste it in Skype. Every message ...
25
votes
4answers
3k views

Dynamic Code Evaluation in Java - Clever or Sloppy?

I am trying to create a flexible ACL framework in Java for my application. Many ACL frameworks are built on a whitelist of rules, where a rule is in the form of owner:action:resource. For example, ...
0
votes
2answers
54 views

Pattern for validating rules having different signatures

I have a class in charge of responding to an input event and maybe triggering another event. To decide, it has several rules to check. I'm trying to get away from a class looking like this: public ...
2
votes
2answers
88 views

When to use ANTLR and when to use a parsing library

I've always wanted to learn how to write a compiler - I've decided to use ANTLR, and am currently reading through the book (its very good by the way) I'm pretty new to this, so go easy, but the jist ...
-2
votes
0answers
40 views

How to encrypt communication between a desktop app and a restful web service [on hold]

I have built a Java desktop application that communicates with RESTful APIs deployed in a Spring Boot webapp. Spring Boot is configured to use embedded Tomcat. I know I need to encrypt the data ...
0
votes
1answer
69 views

Architecture for my Java application [on hold]

I try to create small Java tools to help me at my work every now and then. Usually these do not have to be pretty and I find myself coding a single, sometimes massive, Java class. However, now my plan ...
1
vote
1answer
159 views

Debugging xml and annotations

By now, most web containers have an annotation variant of their xml configurations for Java EE. I'm guessing this is because it's better to keep things in Java where they can be managed, coded with ...
0
votes
1answer
405 views

Dynamic query in MySQL

I'm doing a J2EE web application with Struts2, MyBatis and a MySQL database, so what I want is to allow the user to be free to choose different parameters to perform a select to a table in the ...
0
votes
0answers
25 views

Reading from html page that needs cookies passed and form data

I am writing a program in java in order to practice tough coding problems and learn more. Program description The program reads first names from a text file one by one, then enters them into facebook ...
1
vote
1answer
52 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
2
votes
1answer
55 views

Advantage of Declaring and Initializing Different Object types?

I am learning how to use java to program, and am just learning about abstract classes and how they are useful. Say I have a class which extends another abstract class, which has 2 methods, one of ...
-2
votes
0answers
25 views

Is there a CMS that can be hosted online but is merely a backend for a desktop application? [on hold]

All the CMS's I've used and read about are geared toward building websites. I need to make a desktop application that connects to and grabs data and settings from a CMS-backed online source. There ...
1
vote
1answer
217 views

Is this database design good? What JPA Entities should I create for this design?

I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below. Is this design good ? Any suggestions for improvement are ...
0
votes
0answers
52 views

What are the different types of whitespace referred to by Perl? [migrated]

I am trying to find the Java equivalents of the Perl regular expressions not supported by Java. These are, as listed in the Java Documentation: \h A horizontal whitespace \H A non horizontal ...
1
vote
1answer
35 views

DataThread class that doesn't extend Thread, poor naming?

I created a DataThread class that doesn't extend a Thread, but has one as a member variable. Favor composition over inheritance, is a rule that I heard of, but I am thinking that the name of the ...
-2
votes
0answers
33 views

Get from object or use variable [on hold]

Which one is better //somewhere here i have Test test = new Test(); object String name = "default"; if(test.getName() != null) name = test.getName(); or String name = "default"; String ...
0
votes
0answers
31 views

what is the relationship between CORBA, JMS and MDB?

In the context of my previous fuzzy question on microservices, please help me break down the terminology involved in these technologies: CORBA JMS MDB Utilizing JNDI, I believe it's possible to do ...
-1
votes
1answer
29 views

What's the best way to implement a real time show board to show results from concurrent result producers in Java?

I'm making a load test tool that launches multiple thread to simulate load on the target server. Each thread executes a predefined set of commands in the structure of TestSuite - TestCase- TestStep ...
0
votes
2answers
51 views

How is the best way to work with step by step documentation to software maintenance [on hold]

I'm working on a web project in java and I have a problem with the documentation we are making. The goal is to has step by step how to do some basic stuff for system maintenance, like add fields to a ...
-2
votes
0answers
38 views

Java Web Framework for Functional Reactive Programming [on hold]

Given Java intricate relationship with web applications it appears to have shaped the design applied to how developers create web based applications. From Java 1 through Java 7 from around 1999 the ...
8
votes
6answers
865 views

Static functions vs classes

Let's say that I want to build some utility functions to do some basic maths with the BigDecimals, for example I want to have a function that computes the average of a List<BigDecimal>. What is ...
2
votes
0answers
114 views

Testing a method that reads from standard input and outputs to standard output [migrated]

I have a method which reads lines from standard input and outputs them to standard output. In a JUnit test, how can I have it send standard input to the method and how can it make assertions about the ...
4
votes
1answer
178 views

Is it possible to use the Android layout system in a desktop java application?

I am lazy, thus, if possible, I would like to only have to design and program a UI once. If I want to create an App for Android and as a basic Java desktop application, is there a way to reuse the UI ...
-3
votes
0answers
25 views

Multiple URLmapping using annotation not working in servlets [on hold]

I am using an annotation like this : @WebServlet("/Document/*") and trying to redirect using sendRedirect response.sendRedirect("Document/manpreet121FECF23A-D4D2-E411-BEC4-FCDD55FFFFFF"); I get ...
-3
votes
0answers
92 views

How much programming should I know at the age of 17? [on hold]

I love programming, I will study computer science in college, I am a junior in high school right now. I want to work for big IT companies such as Facebook, Google, Dropbox, Apple.. I want to have a ...
1
vote
3answers
95 views

What is the best way to store and use an application level runtime parameter? [on hold]

I have to design a java console application which accepts a runtime parameter as an argument to the main method. The application will be eventually used by multiple scripts. I would prefer to avoid ...
-2
votes
0answers
39 views

Printing out 2d arrays which contain null values (java)? [on hold]

I'm very new to Java and was wondering if there was a way to print out a 2d array which contains null values, but instead of writing null it just prints a space. My code so far is: for(int i=0; ...
-3
votes
0answers
22 views

Setting up Struts 1.x in eclipse EE luna [on hold]

I need to set up Struts 1.x in Eclipse. I looked into a previous post in the link below . In one the the answers the link given is dead. The website where that tut is does not work ...
5
votes
1answer
170 views

Sometimes, “programming to interfaces” introduces possible (and avoidable) runtime exceptions?

Please consider the com.google.common.collect.ImmutableMap Programming to its interface, Map , creates a bug that could blow-up in the runtime as such: Map<String, Integer> myMap = ...
2
votes
2answers
89 views

Immutable vs Read-only vs Unmodifiable naming difference

So, I've looked at some similar questions asked here in regards to how these three should be used in naming. Usually, the answer is something along the lines of "it's conventional" and "just be ...
-2
votes
0answers
55 views

interoperability java and c++ [duplicate]

i want to write a program in two different languages java and c++ that needs a dynamic and interactive communication between its c++ component and java component.i know there is jni and jna for ...
-8
votes
0answers
72 views

How do I translate my source file to Java bytecode? [closed]

I'm creating a new programming with JavaCC which is the parser. I want the parsed data to be translated to Java bytecode and compiled to Class file which later will be executed by JVM Edit: I'm a ...
3
votes
5answers
425 views

Why is the hashCode method usage of HashSet not specified in the API?

I was trying to debug my code which uses a HashSet and searching through the SO, I found out that I needed to override the hashCode method as well. The strange part is, checking the related API, I did ...
-4
votes
0answers
81 views

Does C# meet my all of my needs? [closed]

TL;DR: Are there any serious issues with using C# over Java for mobile dev and would I be more likely to find jobs in game development with C++ or C#? -- At the moment I'm familiar with HTML, CSS, ...
1
vote
2answers
91 views

OOP (possibly Java-specific): Comprehensive Set of Method Categories [on hold]

I am working on a coding convention to follow for my Java projects. I find it easier to find my way through a class when I group its methods by category. For example, rather than having each ...
1
vote
2answers
65 views

Is it a good idea to contextually name predefined functional interfaces?

I am currently working with Java 8 and using functional interfaces a lot. I often find myself writing code like this: public interface MessageHandler extends Consumer<String> { } Is this a ...
-2
votes
0answers
19 views

How do I access, and encrypt, the RTP stream created by SIP on Android? [migrated]

I am using SIP and an Asterix SIP server to create a p2p RTP connection between two devices. The RTP connection is created automatically when I create a call as described in Android developer guide: ...
-2
votes
2answers
241 views

Why public access level method get overridden in java?

This question is raised with a clarification required to decide when to declare a method protected or public during class design of a package. My point is, if one needs to override a method of a ...
-1
votes
1answer
31 views

JavaFX client side application [closed]

I am thinking of developing a JavaFX client application to connect to my backend database server for retrieval of data etc and display in my client app. For this, i would also need an ...
-1
votes
3answers
106 views

Complex Number help

OK so I have a programming assignment and I need to create a class that represents Complex Numbers (good so far), add them to a list(good so far), and then output whether each individual number is ...
-4
votes
0answers
39 views

How can I create a program which records how much internet data is used by each website visited? [closed]

I don't believe this is even possible but it's worth asking, I would like to create a batch file that when run, it will record all IP addresses or URL's visited during an internet session. It won't ...
5
votes
1answer
152 views

Retry design for high volume

I have a Java system using ActiveMQ for messaging. And the system processes about 400 to 600 transactions a second and we have no issue when everything is running smoothly. The system also got to send ...
1
vote
5answers
237 views

Should abstract classes be used to prevent instantiation

Is preventing the instantiation of a class a valid reason to make it abstract? For example, if I have a class called Gauge which has subclasses HeadingIndicator and AirSpeedIndicator, is it a good ...
0
votes
0answers
4 views

Printing a shape based on inputs from the user [migrated]

I am trying to print a shape based on input; the shape is an "x". The inputs must be positive odd ints, and an arbitrary brush character. I have the code completed for the user input, but I need help ...
0
votes
2answers
110 views

storm topology to handle “dating website”-like workloads

suppose im writing a dating website, similar to okcupid. there are profiles, and i need to compute the (N^2) "match" table - given every 2 profiles whats the match between them? i was thinking this ...
1
vote
1answer
67 views

Writing Multiple Files in Spring Batch [on hold]

So I want to create 6 delimited reports , they all use the same data source and same table , the query is different for each , they all are also independent. The way I have it setup right now I have ...
0
votes
2answers
567 views

HTTP Session: A single object or multiple?

I tested two approaches to store session data: The classic: 1 key, 1 object (And every key as static final String in a class) "user" --> UserObject "preferences" --> List ... An ...
0
votes
5answers
182 views

classes/inheritance, how do I handle special cases that require more change

I often find myself in this situation where I have a base class that does a lot of graphics. There are, for example, three strings that are positioned top, middle, bottom of an element. Like a scale ...