Cole Tarbet

Ranch Hand
+ Follow
since Aug 02, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
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 Cole Tarbet

That's true. I'm part of the vocational-technical state program which required me to take 12 credits to teach. Compared to IT courses, those 12 credits flew by. I think most states have similar programs - called professional-technical or vocational or career and technical education, etc.
11 years ago
After working in public school IT as a one-man support department I recommend that you consider it. I'm surrounded by people who truly appreciate the simple applications I produce on demand for their specific needs and I can go home knowing that I assisted in educating children. The pay may not be so high, but the benefits are great, the atmosphere is friendly and casual, and there are lots of jobs being created by Big Data and the need for teacher accountability. If you are able to do database or programming work as well as teach high school students then you are almost guaranteed a job since there is are so many groups pushing high school STEM opportunities.

Leave the unstable cutthroat software development industry and come make a difference in the real world.

-Cole
11 years ago
I bet I spent around 50 hours over three weeks. ~2 hours for each chapter in the K&B book including questions and the rest on practice exams, reading online materials, coding questions, and posting in forums.

The best thing I did was plan 2 hours for 40-50 practice questions and make sure I understood everything about the question including coding it if necessary. On a test like this, every wrong answer is testing a very specific erroneous thought process and you know you're good when you can say exactly why each answer is wrong.

I missed questions in the varargs/widening/boxing objectives so make sure to look at the "5 golden rules" thread around here.

12 years ago
It's a celebration!

Somebody call Rick James!

ucertify.com practice questions are too easy. K&B questions are too hard. LearnKey MasterExam is about right.
12 years ago
@Matthew - That does make it more clear. The special case here is autoboxing.

Scotty Mitchell wrote:Anyway, what I was thinking is that whenever you arnt looking at non primitives i.e an object of some sort == isnt checking for meaningful equality. Or am I wrong to think this?

Also, StringBuilder is mutable is it not? The immutable thing is pretty important here...isnt that why theirs new object creation?



== checks if objects are the exact same instance in memory. It might be useful to make that distinction in some special case.

StringBuilder is mutable.

Scotty Mitchell wrote:Well, wrappers are after all a subtype of object are they not instanceof!



I don't understand what you mean...?

The reason behind my question is that if I used StringBuilder and append then the output would be true, true because both references refer to the same object. I can understand int being immutable, but it would make more sense if Integer behaved like a regular object.
Just like String... Can't rely on == for comparisons. Thanks!


Why is the output true, false? The wrapper classes don't seem to behave like regular objects.
Realized I could have tested this on my own:

run:
a
a
BUILD SUCCESSFUL (total time: 0 seconds)

Does the cast on line 4 create a new object or do "a" and "b" refer to the same object?
Same question with Wrapper Classes...? It seems obvious here that line 2 creates a new Integer.
The creator of the class has to mark it as Serializable because there could be special consequences only the creator understands. The class could depend on constructor logic or make use of static variables, etc.

Implementing Serializable is your way of telling the world that your class will work like it is supposed to after being deserialized.
Apparently, the unsorted unordered HashSet (pg. 562 K&B) comes with a bit of magical sorting after all. The initial capacity of a HashSet is 16 so adding more numbers ruins the magic. http://download.oracle.com/javase/6/docs/api/java/util/HashSet.html

After reading up on hashing, I realized that this must be caused by the hashing algorithm doing (key % tableSize) which produces pseudo-sorting up to initial capacity. Am I correct?



[15]
[14, 15]
[13, 14, 15]
[12, 13, 14, 15]
[11, 12, 13, 14, 15]
[10, 11, 12, 13, 14, 15]
[9, 10, 11, 12, 13, 14, 15]
[8, 9, 10, 11, 12, 13, 14, 15]
[7, 8, 9, 10, 11, 12, 13, 14, 15]
[6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
[5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
[4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]

[0]
[0, 1]
[0, 1, 2]
[0, 1, 2, 3]
[0, 1, 2, 3, 4]
[0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5, 6]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7, 8]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]

Even though Animal a is actually a Dog right now, the compiler knows that "a" could end up pointing at a regular Animal at some point in the program. If that happens, you will have to be ready to catch the potential exception.
I've been reading about intern(). Mostly confusing.

http://weblogs.java.net/blog/enicholas/archive/2006/06/all_about_inter.html

Sounds like intern() is used for specialized comparison of Strings. I must not be using intern() properly because it looks to me like it slows things down.