Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
17
votes
Accepted
Throw exception if value is not found
Few suggestions:
Naming: A, O, and NV are not clear names. Would be better to use their extended names: ACTIVE, ONBOARDING, and NOT_VERIFIED.
Missing semicolon: NV("not_verified"), should be NV("not_ …
14
votes
Accepted
Implementation of Kamasutra cipher
Strings are immutable
In Java strings are immutable objects, and any modification to a string creates a new string. …
11
votes
Accepted
OOP implementation of Rock Paper Scissors game logic in Java
The code looks fine, few suggestions:
Typo: winer should be winner.
Naming: since the variable player is of type PlayedMove, it's better to name it playerMove. Same for the variable computer. Reading …
9
votes
Accepted
Data-type implementation for rational numbers
As always, nice implementation. Few suggestions about the code:
Divide by 0 must not be allowed. Adding a check in the constructor should be enough:
public Rational(int numerator, int denominator) {
…
9
votes
Accepted
First non repeated character
Welcome to Code Review. There are already excellent answers, I am adding an alternative solution running in \$O(n)\$ and relatively simple to understand.
private static void printFirstNonRepeatedChar( …
8
votes
Accepted
Find minecraft colour codes in string
Welcome to Code Review.
Your code returns false for the message "hello&9", because the method doesn't check the last character. Change the condition in the for-loop to message.length() - 1.
An alter …