Prabhjot Jassal

Greenhorn
+ Follow
since Jul 19, 2010
Merit badge: grant badges
Biography
Preparing for OCPJP
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
5
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 Prabhjot Jassal

Is there any particular reason why StringBuffer does not override equals() method?
why did you loose 9%? :-)..Just kidding, well done
12 years ago
assume you are writing a soccer application :-)..and your task is to keep track of all the goals scored so far at an international level...static modifier is probably the best way to keep track of it
i don't think it would compile as you are trying to access, char c which is an instance variable in static method.
Outer class can not be marked static. This will result in compile time error
Hi Jeet

This question is testing your knowledge about method "overriding" rather than any generics.

All interface methods are implicitly "public abstract" and when you implement any interface you basically overriding its methods. One of the "overriding" rule is the new method can not be MORE restrictive than the original method but could be less restrictive.

in your case we changing the access type from public to default and thus making it more restrictive which violates the method overriding rules.

Hope that helps.
Compile time

Basically this question is associated with method overloading...it is the responsibility of the compiler to decide which method to run and it makes that decision during compile time.
the variable "building" is of static type but the method getHeight() is not. It is important to note that there could exist only one 1 enum in memory eg

Building b1 = Building.LOW_RISE;
Building b2 = Building.LOW_RISE;

boolean areEqual = b1 == b2;

the value of areEqual is "true"

Could someone please clarify this as well...i am not 100% sure on this
Method or variable can not be static unless you explicitly add the "static" keyword in their declaration.

So, enum method can NOT be implicitly be treated as static...but enum COULD contain static methods
Because you have "declared" variable named "acnt" in the main method, so you could only use it only in the main method not anywhere else. It a local variable rather than being an instance variable
Hi Divvya..it's always better to know the latest objectives as they been changing quite frequently in last couple of months

I assume you taking exam in India...so check out this link

http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_851

Latest Topics Removed

1. Serialization.
2. Thread Interaction (Objective 4.4 no longer there)
3. Drag and drop

Nevertheless, it is always better to know these topics as sooner or later you going to use them.
Both ArrayList and LinkedList implements List interface so both of them are ordered by index and dynamically update its size

The difference is in the underlying implementation of these classes. ArrayList under the hood is simply an array and when you do

List a = new ArrayList();
a.add(4);

then the add method creates an array and add 4 to its 1st position

later on if you do

a.add(5)

then the add method creates another array of size = previous size + 1 and copy over the old values and write 5 to the 2nd position

However, LinkedList is all about pointers. It keeps a reference to the next element as well as the reference to the previous element (if it is doubly linked list...by default it is singly linked list)

Doubly linked list are useful if you want to access the previous element from the current position rather than iterating it forward until you wrap back to the previous element

It is better to use Linked List over Array List if your code requires lot of insertion and deletions. Please see this link and hope you find it helpful

http://en.wikipedia.org/wiki/Linked_list