Prasad prap

Greenhorn
+ Follow
since Sep 26, 2008
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
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Prasad prap

what do you mean by "not working in all scenarios"? Can you clarify a bit?
10 years ago
Hi Everyone,

I have an abstract class for which I want to allow only single level of inheritance.
For e.g:




Here I do not want any other class to extend SpecialX. Can I do anything to BaseX to enforce this single level inheritance? I do not have any control over SpecialX so putting restriction on this wont be a solution.

Thanks
10 years ago
Do check this list over Stackoverflow.com
11 years ago
@Eric

This sample of code still is half complete and says very less as others have stated. Edit your post and paste the entire code. Things will be easier for us rather than we guessing on every thing.
11 years ago
Can you post in sample of your code so that your use case make more sense and clear rather than assumptions?
11 years ago
Please watch the signature correctly.

Its is and not .

11 years ago
@Daniel never mind. Thats why this is beginner Java. Do not worry. Shoot your efforts.
Whenever you implement an interface you have to write a definition for methods in the interface.

For e.g:
DO NOT COMPILE THIS CODE. Just observe its concept implementation.



So did you get it why this is wrong?

public static Comparator<Camera> ProductNameComparator
= new Comparator<Camera>()
{
public int compare(Camera camera1, Camera camera2)
{
String productName1 = camera1.getProductName(productName);
String productName2 = camera2.getProductName(productName);

return productName1.compareTo(productName2);

}
};




Let me know if you still need elaboration.
11 years ago
Daniel, Can you post just the snippet(No getter/setter) in the code and the exact error at that line. Things will be lot more easier for everyone.

Anyways,

what is this line just above your constructor doing?

Public class camera implements Comparable



1. Public should be "public".
2. Use case not clear.
3. I believe you used the example literally. I can see Fruit references. Check that out.
11 years ago
@Vijay

Check out this link Throwable

Throwable is the parent class for Errors and Exception. So catch block basically catches Throwable class but we usually write catch(Exception e) often because errors are thrown on much serious accounts. Check out this Stackoverflow
11 years ago
Have a close look at this example:
Comparator example


Let me know if you have trouble fitting that in your example.
11 years ago
implement toString method in Tree class such as



Now call

Tree tree = new Tree(20);

System.out.print(tree); // will print X=20
11 years ago
@daniel

Refer this question. StackOverflow- ClassCastException
11 years ago
Remember null pointer exceptions are always due to no object creation.
11 years ago
What I mean to say is that can I get all process and thread information at once?
Like is it possible for me to access any process any thread?
12 years ago