Can't call methods
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Can't call methods
I have two programs. One has all the junk and the other is the main one that tests it. I keep getting compiler errors that state that it 'cannot resolve symbol' when I try to make the call to the other method. Can anyone give me some begining tips with this? The code would way to long to put here but hopefully someone can make a shot in the dark and figure out my problem. Thanks.
Re: Can't call methods
class Monkey
{
public static String Ohh()
{
System.out.println("Uggg");
return ("bite me");
}
public static String Ahh()
{
System.out.println("It works!");
return ("hello");
}
}
class testAhh
{
public static void main(String [] args)
{
new Ahh();
new Ohh();
}
}
Ok, tell me why this works for 'Ahh' but I get a compiler error for 'Ohh'. These are in two seperate files.
{
public static String Ohh()
{
System.out.println("Uggg");
return ("bite me");
}
public static String Ahh()
{
System.out.println("It works!");
return ("hello");
}
}
class testAhh
{
public static void main(String [] args)
{
new Ahh();
new Ohh();
}
}
Ok, tell me why this works for 'Ahh' but I get a compiler error for 'Ohh'. These are in two seperate files.
Re: Can't call methods
Is the methods alone in 2 files or what?
I tried to put class Monkey with the 2 methods in one file
and the testAhh class in another.
I got compile errors on both methods.
However, a small change and voila! Works.
mvh / regards
Henrik
public class testAhh
{
public static void main(String [] args)
{
Monkey gorilla = new Monkey();
gorilla.Ahh();
gorilla.Ohh();
}
}
I tried to put class Monkey with the 2 methods in one file
and the testAhh class in another.
I got compile errors on both methods.
However, a small change and voila! Works.
mvh / regards
Henrik
public class testAhh
{
public static void main(String [] args)
{
Monkey gorilla = new Monkey();
gorilla.Ahh();
gorilla.Ohh();
}
}