Win a copy of Rust Web Development this week in the Other Languages forum!

Prasad prap

+ Follow
since Sep 26, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
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?
8 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.

8 years ago

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.
9 years ago
Can you post in sample of your code so that your use case make more sense and clear rather than assumptions?
9 years ago
Please watch the signature correctly.

Its is and not .

9 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.
9 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.


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.
9 years ago

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
9 years ago
Have a close look at this example:
Comparator example

Let me know if you have trouble fitting that in your example.
9 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
9 years ago

Refer this question. StackOverflow- ClassCastException
9 years ago
Remember null pointer exceptions are always due to no object creation.
9 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?
10 years ago