I am trying to master the fundamentals of Java and OOP. From my understanding, if I have an object Circle that is instantiated with the variable radius, and passes that to a double x, should methods of the Object be able to access these?
package classes;
public class Circle {
Circle(double radius) {
double x = radius;
}
double area() {
return x * x * 3.1415; // x can't be resolved to a variable
}
}