Topic is calling a class method
but we aren't try to call a class method here
A 'class method ' is a static method in some class.
In the above examples Class B doesn't contain a class method
following code is more appropriate
public class A
{
public static void main(
String[] args)
{
String result = B.someMethod();
System.out.println(result);
}
}
class B
{
// class (or static) method
public static String someMethod()
{
return "Hello";
}
}
Check this out