Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Stephan van Hulst

Saloon Keeper
+ Follow
since Sep 20, 2010
Enschede, The Netherlands
Cows and Likes
Cows
Total received
162
In last 30 days
1
Total given
152
Likes
Total received
1768
Received in last 30 days
29
Total given
182
Given in last 30 days
4
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stephan van Hulst

Under the project properties, I believe there's a "run" menu where you can specify VM and command line arguments.
5 hours ago
Mixing versions is asking for trouble.

Either stick with Spring 2, or migrate your current code base that it uses the new framework properly.
10 hours ago

Arpan Ghoshal wrote:Here the Cat class contains an instance variable containing an object of class Tail but the Tail class is not marked Serializable then how does this code work ?


You didn't try to write an object of type Cat.

Also does a class need to marked serializable to be written to a file using writeObject() ? I think the answer is no then I can't understand what is actually the need for Serialization ?


Yes. If you want to write an object to an ObjectOutputStream, it needs to be Serializable and all its instance fields that are not transient also need to be Serializable.

Why doesn't it print D also ?


Because D is Serializable.

Why shouldn't every class be marked Serializable ?

One of the answers said : The compiler will throw an exception if certain classes are marked Serializable


You've already seen that the compiler doesn't throw an exception when you mark a class as Serializable. It's only when you try to write an instance at runtime, and not all non-transient instance fields are also Serializable.
Yeah it looks like a continue was intended there.
10 hours ago
Like Mano hinted at, it's a tradeoff between precision and memory. If memory is not a concern, then you don't use float.

I almost never use double either, but that's another discussion.
14 hours ago
It's just coincidence. You can't assign a special meaning to that particular number.

It turns out that it's not possible to have an exact binary representation of the decimal number 1.05, using floats. When you multiply by hundred, you also multiply the inaccuracy. Then, you transform the binary float representation to a decimal string represenration, which by complete accident just happens to be lower than the real answer.

The only way to truly understand what's going on is to read the floating point spec, but I doubt it's worth your time because it's not interesting nor important to the average Java programmer.
14 hours ago
Yeah, it's normal. Floating point numbers simply aren't precise. If you need precision, then you need to use BigDecimal.
15 hours ago
Just make the type of an attribute in one of your classes ReportType.
16 hours ago
That code doesn't throw any exceptions when run.

Arpan Ghoshal wrote:Can someone explain this sentence possibly with an example because it seems too difficult to understand for me.



For this you must first have written an object of type D to a file named D.bin.

The expected output is:
Well, it could be that the JSP assumes that the customer is not null, even when nobody is logged in. Passing null would cause the JSP to throw NullPointerException. It depends on what the JSP looks like though, I can't answer your questions without knowing more about it.
17 hours ago
Can you show us the code, and write out the exact commands you use to compile and run it, as well as the current working folder that you run the commands from?

Junilu Lacar wrote:Those algorithms usually require you to keep track of which nodes have already been visited.


Kennith does this by adding the user to an ignore list.
17 hours ago
I can guarantee you will end up with all users on Facebook with a publicly accessible profile. That is, if you don't run out of memory first.

Why do your methods fill fields, rather than just return collections?

Why do you ask users to input user names and passwords, instead of authenticating through OAuth? Users are not willing to give their user names and passwords to random applications.

Use descriptive names. aFOR is not.

'Recommended' is spelled with one 'c'.
19 hours ago
I meant that, for instance, the comparePrecedence method can look like this:

With this code, you know which argument caused the exception and why.
20 hours ago
Josip, I meant the files array. Where does it come from?
20 hours ago