Questions tagged [java]
This challenge is related to the Java language. Note that challenges that require the answers to be in a specific language are generally discouraged.
44
questions
-4
votes
1
answer
231
views
Comparator function in Javascript [closed]
Need to write a JS function compare(a,b) for numbers which return
1 when a > b, 0 when a == b, -1 when a < b.
Also following properties should hold:
compare(NaN, NaN) = 0
NaN is bigger than any ...
21
votes
17
answers
2k
views
King of The Holster (finished)
CLOSED to competing entries
New bots are welcome but are not part of the main competition and probably won't be officially tested.
You stand on a dusty stretch of code, watching the other programs ...
1
vote
2
answers
578
views
Hash bomb filtrate
Pipe a short stream to the following Java program run with accompanying command line options, such that it prints true.
...
-6
votes
2
answers
429
views
Fastest N times Hello World (Java/C/ C++) [closed]
Not a new one:
Input
N, being n, 0 ≤ n ≤ 5.
Output
N times "Hello World."
Example:
Input
3
Output
Hello World.
Hello World.
Hello World.
These 2 are my ...
3
votes
4
answers
506
views
Intercommunication between threads [closed]
So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have ...
33
votes
30
answers
8k
views
Dollar Bill Auction
This is a KOTH challenge for the dollar bill auction game in game theory. In it, a dollar is being sold to the highest bidder. Bids go up in increments of 5¢, and the loser also pays their bid. The ...
37
votes
4
answers
3k
views
Splix.io - King of the land
You are an enterprising dot who wants to increase the land under its control. This is quite simple - travel outside your current land and loop back into your land and everything in that loop is now ...
5
votes
0
answers
290
views
Golf this AP CS Java FRQ - Duplicate Sums of Arrays in 2D Array [closed]
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice.
My friend and I were golfing this during class today and got it as ...
5
votes
1
answer
817
views
Minesweeper Wars [closed]
We've had problems to generate minesweeper games.
We've had problems to solve these minesweeper games.
Now...
It's time to battle other people on a minesweeper game!
Your program must be run in Java....
-4
votes
2
answers
662
views
Shortest program to throw NullPointerException in Java
I find NullPointerException to be interesting since there are no explicit pointers in Java. Here is a program that throws such an exception.
...
-4
votes
2
answers
3k
views
Checking String for enum in Java [closed]
Write a Java method to check if a given string matches any value in a given enum.
Your method will take two parameters, one a string and one an enum, and return ...
45
votes
19
answers
2k
views
Battle of the Fellowships KotH
In this challenge, you are going to create a Fellowship with the goal of defeating all other fellowships in battle.
A fellowship (team) consists of 3 characters. Each character moves independently ...
16
votes
4
answers
2k
views
Java Asterisk Rectangle
For my CS class, my instructor has given us the assignment of creating a rectangle made of asterisks with diagonal lines drawn through it in Java.
He also told us to write it in as few bytes as ...
4
votes
3
answers
678
views
King of the Torus!
King of the Torus!
Your job is to conquer the torus, but wait, there are multiple other players banded together in teams facing you! You will need to use your wit's to conquer the torus.
There are ...
3
votes
1
answer
858
views
Translate Java methods to fields
So, recently, I found myself reformatting my code for Vitsy to using anonymous class instances for commands rather than the normal method approach. For those who don't know, anonymous class instance ...