Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Robin Byrde

Greenhorn
+ Follow
since Oct 31, 2020
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robin Byrde

Thanks for that. I've actually almost solved this now just by using for loops and CharAt. Still working on the repetition aspect by using deleteCharAt. Sometimes you just need to try and explain to someone else what the problem is for the solution to come to you.  Thanks again for your help.
1 week ago
Thanks for all your feedback, I will have a look into these now.

Reply to Piet Souris:  Question: if output is, say, 'b' and the input is 'bb', is that correct?

No. Each char can only be used once.
If you have ever seen the TV show countdown, it's a bit like that I guess.
1 week ago
Hi all,

I'm having some issues with the following part of a game that I am working on.
I have spent hours trying to get my head around this and I think I've just hit a brick wall and could use some guidance, so thanks in advance for any help.

Output: Is 12 random letters.
Input: make a word using these 12 random letters only.
Processing: Check if the input word contains ONLY the random letters (no other characters).

Example:

OUTPUT: HBTDLUEPOIWE
INPUT: But
PROCESSING: CORRECT

OUTPUT: HBTDLUEPOIWE
INPUT: Java
PROCESSING: INCORRECT  


I have tried a number of different things to try and implement this validation such as for loops & traversals etc... I'm now onto trying to use the Arrays.equals function to validate the input. It works But only if the arrays are the same length. Is there a way I can ignore length? Or am I going about this in a totally wrong way?

Here is my latest attempt:



Thanks again for your help.

Robyn
1 week ago
I'm relatively new to java so excuse my ignorance if any of this is way off the mark but:
Would you be using it correctly when:
if you have implemented the equals() method and want to to use an if statement to print to screen if the equals() returns a certain value.
e.g
if(result==true){
System.out.println("CORRECT");
}

2 months ago
Hi Campbell
Thank you so much for your feedback and information. This makes sense! As always though once you uncover one thing in Java more questions follow. I look forward to sinking my teeth into that article fully.
Have a great day!

2 months ago
Hi all, I'm new to this forum and really looking forward to learning from you all but also as I improve help others as well.
I just have a query about comparing strings.  
Code A outputs correct Boolean value (tested with other strings and still returns correct result)
Code B only outputs false regardless of whether the strings are the same or not.
(see codes below)

I think if I'm understanding this correctly, the comparison operator compares objects and not values when it comes to strings which is fair enough, but I really don't understand why A works and not B. The only difference is how the variables are being input, right?

Any enlightenment on this would be amazing! Thanks in advance.

CODE A:



CODE B:
2 months ago