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
10 views

I need help refactoring some Rails code that looks clunky [on hold]

Write an application that prompts a professor to enter grades for five different courses each for 10 students. Prompt the professor to enter data for one student at a time, including student ID and ...
-1
votes
0answers
12 views

I want to display element of the array that user chose [java] [on hold]

I am having problem with my codes ;ㅁ; What I want to do is, first, I want to repeat the process of exploremenu>movestepsize>pick for five times so i can pick up to ingredients Also, I want to show ...
4
votes
0answers
25 views

Generating RPG Characters (Objects)

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. I am trying to ensure I do not advance my knowledge ...
2
votes
2answers
56 views

Computing the name of the month

I created the following program that transforms a numerical month into the corresponding textual month. I initially calculated the starPoint and ...
0
votes
0answers
26 views

Ordered array item insertion based on binary method [on hold]

Array is sorted. I'm asking more about algorithm related stuff. I know that by naming conventions is not good here. Also error handling is not exists yet. ...
0
votes
2answers
87 views

Map easy for beginners to understand

I want to explain to beginners what is a "Map" in Java, with the assumption that beginners do not understand what a hashcode is. As I developed games (tarot, belote, president, pokemon), I know Java ...
0
votes
1answer
18 views

Custom TableRowSorter - New sort order

The purpose of this custom TableRowSorter is to provide me with a different sort order of the columns. It changes the sort order from...
3
votes
2answers
57 views

Caching all the prepared statements in thread safe way

I have a below Singleton class where in my getStatement method, I populate a CHM by doing if check. ...
4
votes
3answers
70 views

Generating 50 Random Shapes

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. For context, I have the assignment details, ...
5
votes
3answers
254 views

Custom exception for string that is too long

This is my first time working with Java exceptions. I have made a program that works to specifications, but I am wondering if there is anything I've done which is unconventional or not recommended. ...
1
vote
1answer
22 views

Tarjan's strongly connected components algorithm

Can anyone suggest to me how I can make this "nicer"? If you can see any glaring details that I could change to speed things up too, that would be great -- though it's not priority. ...
4
votes
4answers
80 views

Check for Palindrome string in Java

I was wondering if you can give me advice on this solution to assess if an user input string is a palindrome or not. How can I optimize this solution? ...
3
votes
1answer
45 views

Snakes and Ladders using a magic die

This is a problem from here where you're given a magic die, and the objective is to find the minimum number of dice throws (hops) to go from the start point to the end of the board, and win the game. ...
0
votes
0answers
10 views

Java out of bounds and infinite loop error on Java dijkstra's code? [on hold]

I am not sure why but I am stuck in an infinite loop somewhere in this code and there seems to be some edge case/out of bounds error that I do not see. Could someone please review my code for errors. ...
3
votes
1answer
52 views

Simple bank account

I believe it is very much possible to make this code more efficient, possibly adding interfaces, inheritance or possibly divide the main class into more classes. I will improve some of the code such ...
5
votes
2answers
62 views

Replacing consecutive equal elements in a list with a new element

In the code below I will replace all consecutive equal elements in a list with a new element. In this case I have chosen the new element to simply be the concatenation of all the equal elements, but I ...
-4
votes
0answers
12 views

About the Nodes ( states ) in BFS algorithm [on hold]

i am confused about the BFS algorithm , i know how can i do the BFS in graph search , for example , a-b-c-d and so on if i have a maze , for example to the maze : ...
0
votes
1answer
67 views

polymorphism with object ArrayList

I've an ArrayList of Object that could contain String, ...
0
votes
0answers
18 views

Simple API testing framework for testing of SOAP xml requests

I have a need to try to automate the testing of a large Web Service with an XML API interface. The framework takes the form of a Mavenised Java project. The usual maxims apply: must be highly ...
4
votes
0answers
64 views

Test and implementation of a reorderable data structure that stores number of users (classifiable as per gender, country, etc.) of an Application

I have implemented a data structure that allows storage of number of users of a hypothetical application in a tree-like data structure in nodes as per their classification based on categories such as ...
3
votes
2answers
64 views

Singleton Pattern + unavoidable Public Constructor

We have an object that needs to be converted to a different type before storing it in database. For that purpose, the library provides an annotation over the field that specifies the appropriate class[...
1
vote
1answer
44 views

Hashing 2 strings to an int and adding to HashMap

I am trying to use an algorithm similar to the Apriori algorithm for discovering frequent itemsets. This program hashes 2 strings to an int and maps them in the HashMap. I'm not concerned with how ...
10
votes
0answers
78 views

Brainfuck to x86 Assembly Compiler

After my Brainfuck Interpreter written in x86 Assembly I decided that it was time to get to the next step, writing a Brainfuck Compiler in Java that generates x86 Assembly and compiles that to an ...
0
votes
0answers
31 views

Extract strings from Deterministic finite automaton

I have created a class which one can build a Deterministic Finite Automaton, with different states - including a start state and one or several accepting states. Also, every transitions has at least ...
0
votes
1answer
53 views

Line count of each file in a given directory efficiently using akka

This is my first program in akka so I wanted to know if the program is efficient and is using the advantages of actor model. The program's purpose is to scan a given directory for any files and print ...
3
votes
2answers
53 views

Enforce execution order with collections of CompleteableFuture's

I receive a message that contains a collection of items that need to be processed. Processing each item involves sequential calls to various services. The services return a ...
2
votes
1answer
64 views

Refactored game of Snake

A week ago I requested a review of my code for a game of Snake. First game of Snake I made some changes based on your answers and now I want to show you present code. Something else to modify here? ...
0
votes
0answers
13 views

Program to ask for three integers and report the minimum [on hold]

I'm trying to break this code up into multiple methods and I was successful with the first bit but the other two I can't seem to figure out. With the second method I was trying to make it so it would ...
4
votes
3answers
116 views

Swing Temperature Converter

I made a simple temperature converter to serve as an introduction to swing. I used Eclipse WindowBuilder and did not attempt to make the components more modular. I'm curious as to how you guys would ...
4
votes
3answers
119 views

Adventure text game

I'm making a text based java game to help me learn java. I would like to know if I am doing things ok and if there is a better way to do the things I'm doing thanks. I have two separate files. ...
3
votes
1answer
49 views

Hackerrank Sparse Arrays Solution in Java

I've just solved this problem and I hope you guys give me any feedbacks to make my code be better. Thanks a lot! Problem: There are strings. Each string's length is no more than characters. There ...
3
votes
2answers
50 views

Compress an array of strings in Android

I'm compressing an array of strings in an Android app. Is there something you would suggest? ...
4
votes
3answers
306 views

Reading properties from file during standalone application startup

I've a standalone Java application, which basically starts and manages two socket servers. I'd like to configure server ports in a .properties file using the ...
8
votes
1answer
827 views

Guessing the JDK home directory

My project is using a specific version of JDK which is jdk-6 and the default JDK_HOME path will vary from distribution to distribution, so I wrote a script to guess it. Is there any way to do this ...
2
votes
1answer
96 views
+50

Android recycler view adapter filter

I am trying to optimize the filter method for RecyclerView Adapter in Android. The list is used as an ArrayList. I have seen ...
1
vote
1answer
83 views

Simple magic 8 ball program

I would just like some input on how I may improve my code(in terms of content not formatting) without changing the output. It's just a simple magic 8 ball program using dialog boxes. ...
2
votes
1answer
64 views

Simple Snake clone in Java

I made a Snake clone for a programming class. I wanted some feedback regarding coding style and will appreciate any other opinions concerning my code. ...
4
votes
1answer
69 views

6502 CPU emulator in Java

I want to make sure I won't have to go back and redo large chunks of code. I have each opcode as a value in an enum that implements Runnable. Is there a more ...
2
votes
3answers
58 views

Returning distinct characters in combined Strings

I am trying to return distinct characters from the combination of 2 Strings. The following is my solution which seems to work based on my tests. Is there a more ...
0
votes
0answers
22 views

Responsibility to Validate Move in chess game? [closed]

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 ...
8
votes
5answers
1k 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
10 views

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

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 ...
2
votes
1answer
42 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 ...
-1
votes
0answers
17 views

My web application in Spring [closed]

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
10 views

Recursive Helper funtion [closed]

Can anyone help me with my code? Why is not working? ...
3
votes
0answers
27 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
62 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? ...
7
votes
2answers
381 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 ...