If I have an abstract class, is it proper form to put a function in one of the fields? or will it cause problems?
example:
public abstract class A{
private double x = z+w/y;
....
If I have an abstract class, is it proper form to put a function in one of the fields? or will it cause problems?
example:
public abstract class A{
private double x = z+w/y;
....
Indeed, you put not a function, just an expression as initializer. There is nothing bad in using it.
Beware however that if your expression depends on other fields, the value depends on the initialization order. (See this answer for advanced details and example)
In short, it depends.
You can do it from a technical perspective, yes - and if it's very clear what's going on and nothing unexpected happens when reading through the code (i.e. it doesn't turn into the next Java puzzler) then it's fine. Bear in mind though that if you take this sort of thing to extremes it can turn into a real puzzle (it can be dependant on the order fields are initialised in for instance) and that's when it should be avoided!