Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

learn more… | top users | synonyms (2)

3
votes
0answers
14 views

Slot Machine Simulator with JAVA

I'm studying alone, so I don't know if I'm writing efficiently. Could this SLOT MACHINE SIMULATOR code be improved? How? ...
0
votes
0answers
18 views

Rewrite calculations java

I have the following method: ...
2
votes
0answers
9 views

REST API integration test

We have a (Spring) REST API that I was tasked to write integration tests for. I wrote various ways to test our REST API and then just decided to make 1 integration test class that processes all JSON ...
0
votes
1answer
15 views

Sort the input file text by most frequent and alphabetically [on hold]

The input file is a long .txt file that is indicated by a path. The program should be able to find the most frequent words in the file. As well as the output should be sorted, if 2 words appear the ...
2
votes
2answers
35 views

Tiling an nxn grid with L-shaped Trominoes

This is some code I wrote in order to see if it was possible to tile a 9x9 grid using trominoes that are shaped like this:   _ | |_ |___| (They can be rotated.) One issue I had while ...
-5
votes
0answers
13 views

How to create folder/subject and create many textfield (card) inside that subject/folder in Jframe netbean? [on hold]

I am doing my flash card study project now in Java application (Jframe) . I already create card with textfield and what I want to ask are : I did not know how to create folder /subject and inside it ...
3
votes
2answers
61 views

Initializing the edge values of 2D array in Java

I have been asked to write Java method code to do the below: ...
3
votes
4answers
57 views

Program to rotate an array

I wrote this code where I have to rotate an array of 'n' elements by 'd' elements in the anti-clockwise direction.Can it be done in a better and simpler way? ...
1
vote
0answers
20 views

Refactoring API endpoint class in Android

I have a class with multiple methods which return a URL string of an API endpoint. Each methods takes different parameters based on what the endpoint have to include. Example, GET: http://api....
3
votes
0answers
38 views

Java REST-assured acceptance tests

I've have experience in unit testing but I'm fairly new to acceptance testing and REST-assured. I would like to get some feedback on my style. This is not a complete list of all my test but a few that ...
3
votes
1answer
34 views

Bot-like Spring Java service for checking advertisements

I am in the middle of developing a Spring Boot application, which has a service acting like a bot. advertisementService.update(Advertisement ad) is a method which ...
1
vote
2answers
65 views

Merging K Sorted Arrays

My aim is to merge k different sorted array with unique elements and I want a code review about it, here is my code below which is written in java; ...
3
votes
4answers
390 views

DoublyLinkedList Implementation Java

I thought I'd ask for a review to make sure I am headed in the right direction. Would really appreciate pointers to what I can fix/change or think of to help me improve my coding standards and be a ...
0
votes
0answers
21 views

Changing the background with a Fragment

This Fragment changes the background of the application. It works well, but sometimes it takes a long time to open. I mean the lowest version of Android, like Kitkat. Is it possible to upgrade it? ...
0
votes
0answers
29 views

Drawing something on an Android phone

This is my class. The class extends View and I use it on activity_main.xml. I have tried to make my code great and easy understand, but I don't know that I have achieved it. This class just allows a ...
0
votes
0answers
18 views

Counting Inversion(swaps) and key comparisons in quicksort [on hold]

I'm trying to count the number of inversions and key comparisons in quicksort. The recursion is throwing me off. My code seems right but it returns a positive swap count for an already sorted list, ...
1
vote
1answer
36 views

Creating an AlertDialog with a list

I am wanting to implement an AlertDialog with a list into my app and I created a sample to see if I can get the result that I am looking for. It seems I do have the ...
2
votes
1answer
78 views

Java 8 streams - restructure entity classes for UI Grid

I have the following domain model: ...
-2
votes
0answers
21 views

Java: Polymorphism and Inheritance [on hold]

Can someone help me start this? I did the Grad class and try to to the main class. If someone could just help me with those two I could figure out undergrad on my own. • Student type can be either ...
-2
votes
0answers
18 views

How can I find the longest repeating(consecutive) substring in a string? [on hold]

The following is my code. I have some testcases and some of them are wrong. In this problem, I should not use suffix tree. All I need is modify or add something to my code so java runs correctly. (...
1
vote
1answer
53 views

Program for an atoi() function in Java

I have written this code to check all the edge cases in the implemention of an atoi() function.Please review. ...
3
votes
2answers
70 views

Filter request code handler

I use the following code which works OK, the code is filtering requests and in case there are too many requests it sends some logs/errors since I'm very new to Java my question if there is a better ...
3
votes
2answers
155 views

First game of Snake

I'm making baby steps in Java programming and I just ended coding basic game: Snake. Could you share with me what is needed to improve in this code? What about OOP here? GameBoard.java ...
4
votes
3answers
91 views

Reading and working with a large number of XML attributes

I'm currently facing the problem of unmarshalling a huge number (47) of attributes to a Java object. Changing the format of the XML file to be more structured is sadly not an option. The following ...
2
votes
1answer
33 views

Animating multiple views in Android efficiently

I am currently making an application where the user will launch the app and the first this we see is the app logo fade in at the center of the screen. After about a second, the logo will translate up ...
-2
votes
0answers
16 views

issue with methods not running [closed]

Can someone explain why the methods wont run? not the best at this... ...
3
votes
3answers
44 views

Converting a text file to a CSV file

I'm attempting to learn more about Java and have created a method that takes a text file with stdout (space separated file) and converts it to a CSV file. I was ...
-4
votes
0answers
36 views

Caesar Cipher File I/O Java? [closed]

So i have a project and I've hit a wall when it comes to the encryption and decryption part of the code. We are supposed to write a program to encrypt files and decrypt them using Caesar cipher. But i ...
-1
votes
0answers
29 views

Consumer Producer with Manager [closed]

Hello All: I am trying to complete the following project. Customer/Cashier simulation For this project you will simulate a customer/cashier problem using multithreading. The idea is to simulate the ...
1
vote
1answer
50 views

Interleave data using Java

...
-1
votes
0answers
25 views

Grade Calculator code challenge for Processing (java) [closed]

So I have this assignment and I'm completely lost. Basically I am given a half code, which is: ...
2
votes
1answer
57 views

Implementation of a directed graph

I wrote an implementation of a directed graph using the adjacency list representation. My goal was to meet the big O requirements which I'd found here. Please let me know about any drawbacks of the ...
1
vote
1answer
40 views

'PostRunnable' implementation in Java [closed]

I know that there any many, many topics and I really read a lot of them, but I have a question about a thing that I couldn't find anywhere. I'm trying to create a ...
2
votes
1answer
45 views

Json type-safe builders using jackson-annotations

I have created these builders to help creating fluent acceptance tests for my api. I would really like suggestions for improvements because this is supposed to be a "how to" project on creating ...
-4
votes
0answers
25 views

how to write these code maintainable and flexible [closed]

i have interface public interface IService{ public Map<String, Object> statistics(Map<String,Object> parameters); } and CommonService extract ...
5
votes
2answers
74 views

Simple Java password rule enforcing

rule 1: length must be between 8 and 50 chars. rule 2: at least 3 of the 4 following rules: --------2a: at least one upper case --------2b: at least one lower case --------2c: at least one numeral ----...
1
vote
1answer
40 views

Basic 4-function Java Calculator with Swing

I can see that there are a lot of java calculators on here, so I hope it hasn't gotten too old. This is a basic 4-function calculator in java using the swing interface. I am positive that it is ...
-2
votes
0answers
13 views

Having problem with the calculation of the bag status on my nimGame program [closed]

import java.util.Scanner; public class testNim { ...
-2
votes
0answers
35 views

Parent-Child-Relations and consistent and immutable objects

Recently I thought a lot about a kind of "pattern" I encountered multiple time over the years: Creating immutable parent-child-relationships. Java aside, the best possibility would be a kind of ...
-1
votes
0answers
23 views

Multiply 2 Matrices using multithread [closed]

My program multiplies two matrices and there are fixed numbers of thread and each thread performs certain number of loops. I have a class "Work" which stores two 2D array whose values are taken from ...
8
votes
2answers
103 views

Color substitution in a BufferedImage

The setPixelColor function below changes the color of pixels. I need some suggestions to optimize this function. Example: ...
1
vote
2answers
72 views

Logging all API call traffic in Java servlets

We have a few servlets like the one below, taking JSON request and produce JSON response. And the requirement is to log all API call traffic. ...
3
votes
1answer
77 views

Image processing: rotation

I've made two functions for image processing: First one is for rotating an image Second one is to set all pixels of one color to another color Rotate Image: ...
1
vote
1answer
20 views

Classical model for database connection provider

Let's forget about Spring Singleton Beans and about other frameworks in Java. We have one or more simple HttpServlets. And we should make database connection. (doesn't matter what is it, hibernate ...
-4
votes
0answers
21 views

My code isn't working! //Netbeans [closed]

My code is supposed to draw a line, when I do two mouse clicks, but it's not working. I am using Netbeans. I did right click the Panel and add Event>Mouse>MouseClicked. P.S. I only recently started ...
2
votes
0answers
49 views

Download a PDF and submit it as a print job

I have following Java code, which is to print PDF, but in a busy location this code is taking about 20 to 30 second delay before submitting to the hardware. get the PDF file via the network download ...
8
votes
4answers
1k views

Picking 10 distinct words 'randomly' from List of unique words

My goal is to pick 10 unique words randomly from a List containing 20 unique words. I would remove the duplicate word from the List whenever a duplicate word is ...