Carey Brown

Saloon Keeper
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
Merit badge: grant badges
Forum Moderator
Carey Brown currently moderates these forums:
For More
Colorado, USA
Cows and Likes
Cows
Total received
85
In last 30 days
2
Total given
9
Likes
Total received
2017
Received in last 30 days
14
Total given
401
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

The new Eclipse has been release. Expect the JDK-22 to follow any day now.

FINALLY this Eclipse supports String templates as a "preview feature" which you have to enable in the preferences if you want to use. Templates was originally released in JDK-21 as a preview but Eclipse didn't support it until now.
5 days ago

Arianna Franchetto wrote:Nope, I came to the conclusion on my own that one possible way to check that the boxes fit in a container was to put a box in the container and then split the remaining area into two further areas (so that they always remain rectangular in shape).

Why "two"? I could  see ending up with a list (tree?) of remaining rectangles.
1 week ago
In your  example you are exposing the Scanner variable to public access. As a private-static-final in a utility class you can enforce all access to have to  come from within  the utility class.
1 week ago
Definitely should be static, with static it's guaranteed to only have one, whereas non-static will have as many as there are instances.
1 week ago
I provided a link to a "KeyboardUtility" in my signature just below this. You can copy it and add to or delete from it as needed by your project. Campbell also has a similar one though we differ slightly on our development philosophies.
1 week ago

Anil Philip wrote:So I was surprised to see a compile error depending upon order of definition of a class, and its usage in a method!


I've been writing code this way for many-many moons with no compile error. What version are you using?
1 week ago
If it's just one String per class you could use a String directly and do away with the classes.
Here you could have a map using id to retrieve  a list of addresses.
1 week ago

Denne Fyren wrote:Basically, a very simple database table. But using a database just for this one thing is out of the question.


Do you need "persistence"? A database would provide that, without one you'd need to roll your own. Probably is simple flat text file would do.
1 week ago
Additionally, there should only be ONE Scanner created from System.in for an entire program. So it  is best to create it as single class constant and reference that one constant everywhere else you need to.
1 week ago
Always use close() EXCEPT when Scanner is created from System.in.
1 week ago
Here you could have a map using id to retrieve  a list of addresses.
1 week ago
That is a typical use of a class. I'm hoping you weren't planning on entering the String "ID" as part of the first row of your data. Header info should be kept separate.

You can keep a bunch of these in a Collection. If your "ID" is unique then you can use it as a key into a Map collection, either a HashMap or a TreeMap. It depends on how you need to interact with the  data.
1 week ago