Dejan Miler

Ranch Hand
+ Follow
since Nov 14, 2009
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 Dejan Miler

I am hoping that this will help



Dejan

# int cannot be dereferenced
# return year.compareTo(b.year);



year is primitive data type so it do not have compareTo method

Dejan
Hi.

We didn't miss anything here.
When we initialize array of object (or primitives) thy are initialized with theirs default value.

Hope that this was helpful
Hi

First of all if equals method do not take Object as a parameter it is not an override method at all (we must respect rules about overriding).
And second you can set Object as argument in compareTo method but then you need to use instanceof and casting to do what you want
Dejan
First part.
In this code (above) we have two threads who are competing for execution time.
Read more about that here

Second part



A static inner class can NOT be instantiated, through an instance of outer class.



Non static inner class cannot access, without having an instance of the outer class.




Dejan.
Hi
Here ls do not have any generic type declared (legacy code)
In another words compiler allow us to put every kind type of data in it


That means that we also can do this


The fallowing are legal simply because thy are super type of List (List interface IS-A)


Dejan.
Interesting code.
Just tell me my friend how are you planing to give a name to object car if that object do not have any member to do that.

Dejan
Hi
The reason is because close method trows IOException.
This code is from Reader source file


/**
* Closes the stream and releases any system resources associated with
* it. Once the stream has been closed, further read(), ready(),
* mark(), reset(), or skip() invocations will throw an IOException.
* Closing a previously closed stream has no effect.
*
* @exception IOException If an I/O error occurs
*/
abstract public void close() throws IOException;



Dejan.
Hello guys.


Here we just accessing to superclass variable and give it new value and that happens before this line of code

And that is all.

Dejan.
First of all char is of integer type.
And secondly i agree with Ankur char will be promoted to float.

Dejan.
Maybe he have another Thread class in that package
My dog yowl like a wolf .
It is good thing to keep me awake at night to lean for SCJP.

Dejan
You have typing mistake on line 12.

Dejan.

Hello
Number 5 or any decimal number is of integer type (integer literal).
First of all this is legal because byte, short and char are of type int



And second this are not legal because thy are not of int type (compiler cannot do auto boxing )
We can solve the problem in the two ways
First by modifying the given value like this



Or we can use casting like this



Dejan.