This challenge is related to the Java language. Note that challenges that require the answers to be in a specific language are generally discouraged.

learn more… | top users | synonyms

149
votes
49answers
15k views

Survival Game - Create Your Wolf

The Board The Board is a two dimensional array of cells. Cells are populated by Animals. Every day, all Animals on the Board simultaneously make one move. If two or more Animals move to the same ...
-7
votes
2answers
277 views

Algorithm to find one unique number in one million and 1 numbers [closed]

I have been asked this question in an interview. In 1 million and 1 numbers, all the numbers having the duplicate except only one number. How to find that one number ? I got an idea to use EXOR gate ...
1
vote
0answers
187 views

fizzbuzz review [closed]

I'm newbie to Java and was trying out this FizzBuzz problem: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the ...
3
votes
1answer
421 views

Flip the commented-out code [closed]

This puzzle works for any programming language that has the same // single-line and /* ... */ multi-line comments that C++, C# and Java do. You are debugging an application. You find a fishy block of ...
-2
votes
3answers
1k views

Write a program to print squares of integers up to 25 in java without using variables?

I asked this question on programmers 10 days back but wasn't able to get the answer that I wanted. Write program in java to print the squares of first 25 integers(1-25) without using any variables. ...
5
votes
2answers
597 views

Write a java code to detect the JVM version

The objective is to write java code that detects the JVM version relying in compatibility changes, side effects, bugs and/or undefined behavior that works in a way in one version and another way in ...
14
votes
11answers
2k views

Tips for golfing in Java

I know I know, not another tips question. But I'm rather surprised that this question hasn't already been posted. At any rate, are there any useful shortcuts that can be used especially in Java? ...