public class thermostst{

private float currenttemp();


I thought in java only abstract classes can contain abstract methods like this!
I got this from a algorithms and data structures book and im guessing its a printing mistake and currenttemp should not contain the () .

Thank You

No, it's not valid. The method currenttemp() must either have a body in {} or be declared abstract, in which case the class must also be declared abstract.
Without the () currenttemp becomes a float variable, not a method, and the code is valid.
We can only guess what the original author intended, but if he was following standard Java conventions that method would be called getCurrentTemp(), but then it wouldn't be private. My guess is that it's probably intended to be a variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.