is it possible to call a method into another method?
i can see the error into my code and it's not possible for me to call range() into System.out.print() function.
if possible give me a solution here.
public class Main {
public static void main(String[] args) {
A obj1=new A();
System.out.println("The value of x from the class A is "+obj1.x);
System.out.println("The value of y from the class A is "+obj1.y);
obj1.range();
System.out.print(obj1.range()); // error shows here. it's not executed . method calling method.
}
}
class A{
int x=2,y=7;
public void range()
{
int z=x*y;
}
}