Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
i like this logic, bravo man
it's the cleverest idea to solve it! Congrats!
Why use reverse, if we can traverse the array from the end?
I wanna know hou you got this idea
I must say that it possibly not universal solution, but deffinitely very resourcefully!
Can be done with BigDecimal rather than with String parsing
that makes two of us, I feel so dumb after I finally get a solution and I submit, someone posts something like this and I feel like a neanderthal. ;D
Nice Code !
Explain why I have an error
Exception in thread "main" java.lang.NumberFormatException: For input string: "8,6667"
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.base/java.lang.Double.parseDouble(Double.java:735)
at Main2.barTriang(Main2.java:14)
at Main2.main(Main2.java:21)
Are you sure that it is the same code?
This should happens only if the 'nums' was a char[] not a String[];
In the case of the char[] you would need to use result[i] = Character.getNumericValue(nums[i])
It is a short hand if else statment. Each of the statments
(p1 + p2).equals("scissorspaper") || (p1 + p2).equals("rockscissors") || (p1 + p2).equals("paperrock")
are all conditions of the if statament and if any of them are met then the player that wins will be 1.
When it says
int p =
at the start it is stating what will the 1 : 2 equal after the if statment.Yup, i got the same idea. But im not familiar w Java syntax. I'll keep practicing.
Best practice is what people voted best practice. You must get used to it, and if you don't agree, you are free to vote for whatever you think is good practice.
why is this best practice? if statements are much more readable
G E N I U S
Loading more items...