Skip to main content

All Questions

Tagged with
39votes
8answers
5kviews

Immutable objects in Java

I just finished studying immutable objects and their advantages so I thought I'd create one of my own. Here is my employee class that extends a person class. It is not mutable since I have getters to ...
Ishan Soni's user avatar
36votes
5answers
216kviews

Implement a Shape abstract class

To learn more about OOP, @nhgrif challenged me to implement a Shape abstract class (more details in code remarks below. Here is how I did it. Any and all advice appreciated! Shape.java ...
Phrancis's user avatar
32votes
2answers
3kviews

A grid and a menu walked into a program

A program that creates a grid 10x10 and assigns a random number in each tile. It then asks you if you want to: create a new grid view the current one count how many of each number there are in the ...
Henrik Bohlin's user avatar
31votes
4answers
17kviews

Beginner object-oriented text-based RPG

I'm in the process of writing a text-based RPG in Java using object-oriented programming. I'm fairly new to programming and currently learning through CodeHS and coding this within their sandbox, any ...
WatCow's user avatar
31votes
3answers
3kviews

FizzBuzz implementation using the ternary operator

This is my first time writing JAVA, and I'm trying to start off on the right track. Using my C++ knowledge, I was able to understand the syntax for the ternary operator, but I'm not sure how it ...
Jamal's user avatar
30votes
7answers
29kviews

Basic OOP Poker - Deck, Cards and Hands

I decided it would be interesting to simulate a game of Poker. Baby steps at the moment, and eventually I'll attempt to turn it into a GUI. The code I have so far is very basic such as populating a ...
dan's user avatar
  • 303
30votes
6answers
23kviews

"Guess a number" game

I began the journey to be a self-taught programmer about a month ago and my biggest fear about teaching myself is developing bad habits and not realizing it. I'm looking for criticism on this "Guess ...
Mike Medina's user avatar
27votes
8answers
13kviews

Basic Java library to hold books

For my education, I have written this basic library in Java. Maybe someone can see something that I can do better, as I'm just beginning with Java and I'm hungry to learn more. ...
djaszak's user avatar
26votes
4answers
4kviews

Calculate distance using speed of sound

I've been working on learning Java and this was a challenge as part of a chapter on data types: Create a program that computes how far away, in feet, a listener is from a sound. Sound travels ...
Phrancis's user avatar
26votes
3answers
2kviews

Adding a course to one of 8 periods

I have this rather ghastly if statement and I'm sure there is a way to condense it, but I don't really know how. I was told a ...
RexPRGMER's user avatar
26votes
2answers
3kviews

Android Flashlight app

This is my first project, a Flashlight application for Android-based devices: ...
user avatar
25votes
5answers
3kviews

Hello World, Phrancis

I just yesterday started learning some Java. I wrote this piece and got some help from @Simon André Forsberg to refine it some. I added a few things since. It's super-simple but I just want to make ...
Phrancis's user avatar
25votes
2answers
1kviews

The grid looked at the menu and said "Something with class, please"

This is a follow up on my previous question: A grid and a menu walked into a program I integrated classes into the mix. The program now asks how big you want the grid to be. ...
Henrik Bohlin's user avatar
24votes
6answers
24kviews

Beginner number guessing game in Java

I am a first year CS student. We are currently learning Java and my latest assignment was to create this random number game. I am hoping to get some feedback on code style etc so that I know what not ...
jjacobson's user avatar
24votes
2answers
22kviews

Texas Hold'em in Java

I have been a programmer for 12 years, mainly ERP software and C development and am looking to make a career/specialty change to Java. I've read it countless times if you want to learn a new language ...
user avatar

153050per page
close