Hello
I'm doing a course in Java and I've got most of my program working, only there's one structure that won't work. I can't even get a listing from a book with a similar structure to work. Here's an example program:
public class Person
{
public static void main(String[] args)
{
int age;
int ageInNYears(int n)
{return age + n ;}
}
}
It always gives me the error message:
; expected
at the line:
int ageInNYears(int n)
I'm actually trying to get a different more complex program to work, but it's falling at the same place in the program - wherever I'm trying to create a method using int. I'm using JCreator. I've got other programs to compile just fine. It's just this construction that isn't working for me so far. I've tried adding in semi-colons all over the place and it's not working - I must be missing something more structural unrelated to this specific line where it fails.
It is completely doing my head in!
If anyone can shed any light on this, it would be most appreciated.
Thank you kindly!
I'm doing a course in Java and I've got most of my program working, only there's one structure that won't work. I can't even get a listing from a book with a similar structure to work. Here's an example program:
public class Person
{
public static void main(String[] args)
{
int age;
int ageInNYears(int n)
{return age + n ;}
}
}
It always gives me the error message:
; expected
at the line:
int ageInNYears(int n)
I'm actually trying to get a different more complex program to work, but it's falling at the same place in the program - wherever I'm trying to create a method using int. I'm using JCreator. I've got other programs to compile just fine. It's just this construction that isn't working for me so far. I've tried adding in semi-colons all over the place and it's not working - I must be missing something more structural unrelated to this specific line where it fails.
It is completely doing my head in!
If anyone can shed any light on this, it would be most appreciated.
Thank you kindly!