elPete Martin

Greenhorn
+ Follow
since Apr 27, 2006
Merit badge: grant badges
For More
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 elPete Martin

I have a question regarding the class objectOutputStream and its method writeObject().

If only Serializable objets can be written in the method writeObject(), why does the method accept any kind of object? I know it will throw a runtime exception if the object is not serializable, but why can't it throw a compile time error?

Weird.....
with the aswere B I get

Type mismatch: cannot convert from List<capture-of ? super Integer> to List<Integer>

what about you??
Where can I find the errata for this book??
where cna I fin de errata for this book?

tanx again
In the chapter 7, the question 16:

Given a method declared as:
public static <E extends Number> List<? super E> process(List<E> nums)

A programmer wants to use this method like this:

// INSERT DECLARATIONS HERE
output = process(input);


Which pairs of declarations could be placed at // INSERT DECLARATIONS HERE to allow the
code to compile? (Choose all that apply.)

And they say "B" is a good answere:

B. ArrayList<Integer> input = null;
List<Integer> output = null;

I try it with a real compiler and it doesnt work.
Is it a mistake?

Tanx