Campbell Ritchie

+ Follow
since Oct 13, 2005
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 Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Campbell Ritchie

emma roberts wrote:I am preparing for version 6 certification . . .

That doesn't explain why you are sitting an out of date exam, as Ganesh has already asked.
Not sure I understand that post, but in the case of the circular saw I mentioned earlier, it needs to be installed. Unless I connect it to a source of energy, it will do nothing. I can only cut wood with it if I provide it with electricity. Nothing we can make exists in isolation. Yes, you must have hardware to run software on. Yes, you mist have a floor to put the circular saw on, and electricity to make it work.
1 hour ago

Odie Young wrote:I think I was able to answer my question by finding another post on this site!

Well done Please show us the solution.

A few minutes ago, I wrote:. . . you must only assign things to references when the type of what you are assigning and what you are assigning it to are the same. . . .

Because it is possible to convert references at runtime, it is possible to assign things where the types are compatible, not only the same. You can for example assign an int to a long variable, but not vice versa. You can assign a String to an Object reference but again, not vice versa.
Because Java®'s typing is “static”, you get a compiler error for the wrong type, not a runtime error.
1 hour ago

Odie Young wrote:Hi all,  . . .

Welcome to the Ranch

I can't convert the java.awt.Color.RED to a string or some variation of that.

No, a colour is a colour and a string is a string, and ne'er the twain shall meet. Because Java® is a strongly‑typed language, you must only assign things to references when the type of what you are assigning and what you are assigning it to are the same.

I have also tried this constructor:
. . .

No, constructor parameters look exactly the same as method parameters. You have type followed by what you are calling it for the purposes of the constructor or method. You would write Color colour or something like that.
Where did you get the 320 and the 90 from?
1 hour ago

Matt Wong wrote:. . . . From the etymological point of view it's similar to german "weite" - width - and "breite" - breadth - and as both common in german - . . .

Careful about etymologies. An etymology doesn't determine the modern meaning of a word. The etymology of the English word large and the French word large are doubtless the same, but they mean something different. Similarly the English word wide has a much more restricted range of meanings than the German word weit which is, as you say, most probably its origin. Weit can mean far, which the English word wide usually doesn't.
1 hour ago

Knute Snortum wrote:They're a little bookish. . . .

All real words; some of them however are used rarely.

There was (is?) a magazine called National Lampoon.

Lampoon is in normal use, but not frequently.

"Seamy" is conversational. . .

Seamy is usually used in the most informal contexts only, or in articles in the cheaper newspapers

"Visage" is conversational. . . .

It is usually used in an ironic or sarcastic context.

"smote" and "smotten" . . .

Smote is the past tense of smite. Smotten should be spelt smitten. Smitten is used as a verbal adjective in a romantic sense separate from its meaning as the past participle of smite.

"Retaliate" is conversational. . . .

I would say that retaliate is the one word on that list that is actually used at all frequently, in formal and informal contexts, at least on this side of the Pond.
1 hour ago
Please check whether it is in the stdlib header which you are including.
2 hours ago

Carey Brown wrote:. . .  The requirements don't specify those names. . . .

That is one of the places where I am relieved to find I was mistaken. MG: please take note and change your variable names.
2 hours ago

Paul Anilprem wrote:. . . Ability to access static members using a reference variable is the worst 

Good point. If you look in books like Java Puzzlers by Bloch and Gafter, you can see the sort of error that can occur if you call static methods on an instance reference.

Maurizio Gasparro wrote:. . . do: create fields: aptTenName; aptNum; monRent; terOfLease;

You are going to have to create fields with those names, even though I think they are poor names. They are difficult to read out and they do no t make it clear what they mean. Be sure to use exactly the spelling you have been given.

do: create a contractor that initializes the fields: aptTenName = "XXX"; aptNum = 0; monRent = 1000; terOfLease = 12;. . .

That is an unusual spelling of constructor. Be very careful copying that sort of instruction, And avoid predictive text.

p.s. thank to everyone who's helping me, I really appreciate it ;-)

That's a pleasure Sorry we sound so negative sometimes.
11 hours ago
Yes, it would be a good idea to take time to study such an example, implement it yourself, and find out what can go wrong. I think you can learn as much from code which goes wrong as from code which runs beautifully and produces a “correct” result.

Jake Monhan wrote:. . . Speaking very simplistically wouldn't the problems raised by w.setTemperature(1000); be solved by modify the if condition to if (degrees < 0 || degrees > 200) { }?

I shall leave you to work out what would happen if you allowed an argument of 200 without taking extra precautions. The point I was trying to make is that we don't know whether the Water class takes such precautions; if it doesn't, then it is possible to use the Water class to heat the Kettle to a temperature of 1000°. Remember that the second version of Kettle doesn't have temperature and content fields; it has to take them from the Water field. Also remember, I was showing that version of the Kettle class as an example of bad design..
11 hours ago
Please find out how to reduce lines 14‑18 to one expression with the ?: operator.

Josip Skako wrote:. . . I'll describe it more precisely. . . .

Does that tell us where the exception was thrown? Please answer RC's question.
1 day ago