+ 1
Help! It doesn't work D:
8 ответов
+ 1
Because you capitalized the words. java is case sensitive, if you don't write exactly how they are, throws an error
+ 6
This is the way you have to do it.
public class Cat
{
static void Voice(){
System.out.println("Meow!");
}
}
class A{
public static void main(String[] args) {
Cat.Voice();
}
}
The reason is that you created the Voice method as static, and that makes that you can call the method without creating an object of that class, however, the Voice method is in other class, so we reference it: Cat.Voice().
btw: should be 'voice' in lowercase.
+ 3
Please, Make your code public, and tell us if any comment did help you...
+ 2
keyword class is with lowercase c
+ 2
It didn't help me:(
+ 2
Thank you all!
+ 1
you declared wrong the class in line 7.
try this: public class A {
0
Yes, it helped me, thank you)