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 byte-code and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

learn more… | top users | synonyms (2)

0
votes
1answer
21 views

Is this implementation of doubly linked list correct?

I am trying to follow the template provided here to create a doubly linked list in java. This homework is based on this lecture. Can someone please review my implementation? No change to this part of ...
6
votes
3answers
217 views

Entering two integers and returning a decimal fraction

After a couple of small programs in Python we are now asked to do some basic stuff in Java. I don't really know where to start to improve this and whether it's even necessary. This is an exercise, so ...
0
votes
0answers
14 views

Issue with Address book program [on hold]

My professor gave us this source code as a template for a project and there are errors when BinarySearchTee is called. I'm not entirely sure as to why this is? ...
0
votes
0answers
12 views

Converting a wrapper object to a value object

I have ChannelWrapper and Channel Value Object. I want to convert each and every field of ChannelWrapper to Channel Value ...
-3
votes
0answers
11 views

Recommended DAO package structure [on hold]

When creating a package structure for DAO in spring/hibernate project, what is the recommended approach? Should Interface and Implementing class be on same package or different package? Or What will ...
0
votes
1answer
27 views

Nearest point using 2D tree, static variable for the closest point so far

This is a problem from a Coursera class: Write a data type to represent a set of points in the unit square (all points have x- and y-coordinates between 0 and 1) using a 2D tree to support ...
1
vote
1answer
43 views

Drawing sets of boxes to display contents of arrays

This code draws two sets of 9 boxes on the screen to display the contents of two arrays. How can I speed up, shorten and make the code more efficient? ...
1
vote
0answers
32 views

Loading the JDBC driver jar dynamically from external location

I have a small project in which I get the URL, username, password, and driver from a text file and I have to fire a query on the database by dynamically reading the jar file in a predefined directory, ...
-1
votes
0answers
20 views

how to perform calculations using stacks Java [on hold]

Hello everyone I have to do a java calculator using stacks and when i try to do the calculations it does not work. Example if my stack contains 5 and the user enters -2 stack should change to 3. Here ...
0
votes
1answer
16 views

Including references in onResume Lifecycle

What's a more concise way to do this? It's way too verbose for my taste. ...
4
votes
1answer
56 views

School which registers students by preferred courses

The point of the application is to create a school, create courses for that school, create students and register them to the school, assigning them courses based off the courses they prefer. There ...
3
votes
1answer
60 views

Removing duplicates from unsorted LinkedList

Removing Duplicates: ...
1
vote
2answers
68 views

Simple deck of cards

I had recently completed one programming challenge where I've had to design a deck of cards. The time was limited but I tried my best. I designed the basic operations and am wondering if I can improve ...
0
votes
0answers
13 views

Passing data from domain to UI in Java [on hold]

How do you pass data to paintComponent(Graphcs g) without using a direct reference to your domain in your view logic? ...
2
votes
1answer
37 views

Score Validation

Was just wondering if I was using nested if statements to much. I've been looking around and it seems that people try to not use them. Also does the code look messy in any way? Anyways here it is: ...
0
votes
1answer
37 views

File input and sorting averages with movies

So far I have Java code that will: take in two .csv files store each line as a string in a string array split it into a 2D string array where a comma would act as the separator sum the number found ...
1
vote
1answer
66 views

Save parameters in a “key: value” format

I have been playing with Java for around a year and I started writing this API for storing data in files. I wrote this method which will save the parameters in a "key: value" format in a file. The ...
1
vote
0answers
50 views

OOP bank database

I have been working on this: Design a class for a bank database. The database should support the following operations: ❍ deposit a certain amount into an account ❍ withdraw a certain ...
0
votes
2answers
53 views

Displaying a city name with concatenations

I am learning MVC and Android. I have create a sample program which is supposed to implement the MVC philosophy. I plan to build my codes on top of this. I wish to know whether I have got the concept ...
1
vote
1answer
45 views

Flattening a HashMap of (String → ArrayList) to an ArrayList

I have one HashMap<String, ArrayList<String>> and I want to concatenate a key with every item in its ArrayList. ...
3
votes
1answer
41 views

StreamIterable - create an iterable from a Java 8 Stream

This seems like an easy thing to mess up, so I'd be grateful if you could think of any edge-cases that I've missed. ...
0
votes
0answers
27 views

Spring MVC OneToOne mapping is not working [on hold]

Query: How to validate OneToOne object in the Spring MVC? i.e. return an error to the JSP page from Spring MVC BindingResult if OneToOne mapped object is inputted null? In the following class, if ...
-3
votes
0answers
16 views

Error at JOptionPane row and outFile.println row (61 and 63) [on hold]

I have this project and I'm stuck at the end...row 61, 63 have errors. Can somebody help me? Thank you Create a Java Project to be named PayRollProject using NetBeans IDE that allows the end user ...
5
votes
3answers
229 views

Close Scanner if no input

I'm in very early stages of learning some Java coding. I'm asking for this review because, although the code below works, I'd like to know if it's an ugly way of achieving it. What I want the code to ...
5
votes
2answers
277 views

Quiz Evaluation

I have written a code for following problem: Write a program to grade a short multiple-choice quiz. The correct answers for the quiz are: C 5. B A 6. C B 7. C D 8. A ...
1
vote
1answer
45 views

Factory object with a dependency on a bean

My problem is quite straightforward. I want to build a factory, but the kind of object returned depends on a value read from a bean that is somehow a cache. So of course, I can't call the bean's ...
1
vote
1answer
29 views

Web Service implementation on the client

I will be creating a web service as part of a group project for university, which will be developed using Java within the Eclipse IDE. Having no prior experience using web services, I managed to ...
1
vote
2answers
66 views

Bank simulation using ArrayList

Problem Statement: Design a BALANCE class with account number, balance and date of last updation. Consider a TRANSACTION class with account number, date of transaction, amount and transaction ...
13
votes
6answers
1k views

Determining whether two scrambled strings are equivalent

I was able to complete the problem doing it in this manner, but I would assume there has to be an easier way. Sample input: abc, cba Output: ...
1
vote
1answer
32 views

Getting recent stations

I made a database for my Android app using SQLite and it works fine. However, as I understood, SQLite calls shouldn't be made on UI thread. Is the below okay or not? ...
-2
votes
0answers
27 views
5
votes
2answers
86 views

Overloading email sender utility class methods take single or array arguments

I'm writing a simple utility class for sending an email. I'm not sure what's the proper way to present this to a consumer. Should I force them to use an array in ...
5
votes
4answers
293 views

Java Stream Exception Handling

I find this piece of Java code really ugly and cumbersome. How can I refactor it to be more clean and easier to read? ...
3
votes
1answer
54 views

JavaCC Android port User Interface (Activity) class

I have been working on a port of JavaCC for Android. It is mainly an interface. I needed only to modify the original source to redirect output to a TextView. The point of this project is to rekindle ...
0
votes
0answers
19 views

Im having trouble creating this yahtzee game in java [closed]

Basically i have to create the yahtzee game with the methods like 4 of kind 3 of kind, small straight, large straight, etc. Im having trouble figuring out a way to check if the dice rolled fit in any ...
8
votes
2answers
263 views

Making a text-based RPG game

I started making a text-based RPG game and before I spend a lot of time on it, I wanted to know if there is a better way to make it. Currently I'm using switches to flow through the game, I also know ...
-1
votes
0answers
33 views

Reflection of an object in a 3D world

The following is a excerpt from a class that is supposed to represent a reflection of an object in a 3D world, like in a mirror. After I started I discovered that mirroring is a property of an ...
0
votes
1answer
63 views

Streamlining a method to run faster

Update: I did some guesswork tweaking and let the heap reach a maximum of ~450 Megabytes (was originally using invokeAll). The program just finished in 6.3 minutes. I've been advised to use ctrl + ...
-2
votes
0answers
10 views

assignment types [closed]

Is there any problem in assigning Integer to int? int x= Integer.class.cast(parameters.get("PO_PAGE_CNT")); As Integer is the parent class and int is the ...
5
votes
3answers
498 views

I command thee: do SOMETHING

I am currenly contributing to a Chat-Bot to be used across the whole SE-Network's chat which is implemented in Java 8. This bot is supposed to have commands. These commands again are supposed to be ...
-1
votes
1answer
46 views

Better method definition [closed]

...
1
vote
2answers
34 views

Codility AbsDistinct: Why is this solution not O(n)?

This is part of a series of algorithmic lessons and tests by Codility. For copyright reasons, I cannot reproduce the question, which asks to compute the number of distinct absolute values in a given ...
1
vote
1answer
29 views

Using composition or inheritance to enhance this linked list

Problem Statement: A method called insertEnd() exists, but it runs in linear time, because every time it is called, it walks down the list to find the end. Without changing the meaning of this ...
7
votes
1answer
59 views

Karp-Rabin with bitwise hash

As a Rags-to-Riches re-implementation of the Karp-Rabin question here, from @tsleyson, I thought it would be interesting to understand the algorithm better, and to use bitwise-shifting instead of ...
0
votes
0answers
27 views

Enhancement to Trezor library for Android

I'm only asking because I'm new and don't know enough to have a concrete question. Did I do this correctly? I worked on this until the code performed as expected, but I don't think I'm done. In ...
1
vote
1answer
65 views

Reading columns of a delimited text file

This class reads a delimited text file into String arrays on demand. Delimiter can be any regex. Features include: Read a single column Read a range of columns Read arbitrary columns by providing ...
5
votes
3answers
67 views

Karp-Rabin String Matching, Part 2

Part 1 is here. I wrote a Java implementation of the Karp-Rabin semi-numerical string matching algorithm. I incorporated the suggestions of @fge and @maaartinus from the other question into my new ...
0
votes
1answer
35 views
-2
votes
0answers
31 views