-
}
}
public class B{
public static void main(String args[])
{
A a=new A();
System.out.println(a.meth1());
}
}
The above code gives a compile error.It says cannot use void.If the return type is not void then it compiles sucessfully
what could be the reason?">class A{public static void meth1(){System.out.println("Inside method 1");}}public class B{public static void main(String args[]){A a=new A();System.out.println(a.meth1());}}The above code gives a compile error.It says cannot use void.If the return type is not void then it compiles sucessfullywhat could be the reason?