syntax problem crating a method that returns an object (java)
- by David
I'm trying to create a method that will sum two timeO objects and return a new TimeO object called sum.
Here is the relevant code snippet:
public static TimeO add (TimeO t1, TimeO t2)
{
TimeO sum = new TimeO ;
...
}
When i try to compile it i get this error message:
TimeO.java:15: '(' or '[' expected
TimeO sum = new TimeO ;
^
1 error
i cant think of any reason why it would want me to open a set of parenthasies or brackets here but its possible that i dont' quite understand the syntax. Whats going wrong here?