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)

0
votes
0answers
5 views

Responsibility to Validate Move in chess game? [on hold]

I came across couple of software LLD to design chess game. I have a specific question where behavior to validateMove of pieces should lie ? Should it be part of piece class or validator class ? Per ...
1
vote
1answer
8 views

FizzBuzz Implementation in Java

Fairly new to learning interview questions and I saw this one and gave it a shot. I would very much appreciate some constructive criticism of how I went about it and what you would tell me if you were ...
0
votes
0answers
5 views

Monty Hall Java Project - stuck in a while loop that scans user response [on hold]

I just learned how to code a few months ago so pardon my style, I know there are many more efficient ways to do it but please understand that I am still expanding my skill set. In class we were asked ...
1
vote
1answer
16 views

Finding an arbitrary word in a string of words given an offset

Background Given a string (s) and an offset into that string (offset), find the whole word that can be found at the given ...
0
votes
0answers
10 views

My web application in Spring [on hold]

I am learning Spring and I wanted to show you what I'v done so far. In this project I am using: Spring, Twitter Bootstrap, Apache Tiles, Hibernate. Code: https://github.com/siejajedrzej/quick ...
0
votes
0answers
7 views

Recursive Helper funtion [on hold]

Can anyone help me with my code? Why is not working? ...
2
votes
0answers
24 views

PopupMenu implementation that hacks inflating a @MenuRes

Summary Usage will ask for a Context and a @MenuRes and then use the ...
-1
votes
4answers
48 views

Unique values of an array

I'm curious if there is another way to code this. Could it be done with a while loop for instance? ...
-2
votes
0answers
17 views

The vending machine program [on hold]

Requirements: The vending machine program will be able to : Set the name of each of the 4 phones The amount of each phone in stock Give the option to buy one of the four different mobile phones (e.g.,...
6
votes
2answers
343 views

Huffman compressor in Java

I have this Java program that can en-/decode files, both text and binary. What comes to critique I want to hear anything regarding these points: Performance, Modularity, Coding conventions, Naming ...
5
votes
1answer
52 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
22 views

Rewrite calculations java [on hold]

I have the following method: ...
3
votes
1answer
22 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 ...
3
votes
2answers
44 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
14 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 ...
1
vote
1answer
59 views

Object Pool implementation using blocking queue in java

You need to design and implement a generic pool for storing objects (implementing poolable). The pool should support following: A support for creational pattern which would be used by ...
3
votes
2answers
67 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
61 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
22 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
41 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
67 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
392 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
30 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
79 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 [closed]

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? [closed]

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
71 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
157 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
37 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
75 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
41 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 ...