Campbell Ritchie

+ Follow
since Oct 13, 2005
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Campbell Ritchie

Nobody ever liked anonymous classes anyway, and nobody shed any tears when many of them were replaced by λs.
8 hours ago
You can't reuse it anywhere from that interface anyway; it would only compile with private access when I tried it.

[edit]Sorry, I said interface when I should have said anonymous class.
8 hours ago
Welcome to the Ranch Other people have posted about the same scanner.
15 hours ago

Fikri Harlov wrote:. . . If method display() contains 20 lines source code, it will be ugly to be in the forEach() . . .

There is a lot more to it than that. Have you tried it yourself?
15 hours ago
Please avoid abbreviations like, “pb,” which is not clear to all readers.

We can only help if we have the full details. Which module is that package in? It appears not to be in Java21SE. Do you have Java® installations? Do you have EE classes installed anywhere?

Monica Shiralkar wrote:. . . I think in actual it is an object that it accepts (not interface). . . .

I am getting the impresssion that we are going in circles about things that don't actually matter.
A parameter has a type, which is what Stephan means, and at runtime a copy of a reference to an object of that type, not the actual object, is passed.

Junilu Lacar wrote:. . . Tests are a different animal. . . . snake case . . . .

Yes. I had qute forgotten about that
1 day ago
Apart from the bad indentation: that trick would work. It does seem overkill, however, to extend that interface to add a method. What would happen if you added that method to the anonymous class?
Welcome to the Ranch

Please show us how you are selecting your value form the database. How are you casting it?

If you are really a beginner at Java®, maybe is would be better to learn Java® basics before you try adding Spring to your programming.
2 days ago
Please indent your code correctly. Please don't quote the whole of the preceding post which doesn't add anything new and is liable to deletion. Please don't use formatting tags on lines of code.
3 days ago

Juan Hidalgo wrote:. . .. . .

Just like RM, I am unable to compile your code because some is missing. I can see some errors however. For example, the above is not a default constructor. I don't know whether it is a good idea to overload the constructor name like that.
I think you are wrong to use an Object[][] and cast its elements when you could use a ShipPiece[][] instead. It is also a bad idea to pass a reference to an array without taking a defensive copy.
I don't think the boolean called isTurn is the correct way to handle alternating players. And why is it volatile?
3 days ago

Babu Muthukrishnan wrote:. . . the program will replace the bad word with asterisks . . .

A long time ago I was at a well‑known University in LA and the email system had such censorship. I had something to drink and then thought I would wash it down with some beer. And the system changed that to, “waXX XX down…”
3 days ago