Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question on objects

Status
Not open for further replies.

satellite03

IS-IT--Management
Dec 26, 2003
248
IN
i have question on this code

Code:
class TestCircle
{
  public static void main(String[] args)
  {
    Circle myCircle = new Circle();
    System.out.println("The area of the circle of radius "
      + myCircle.radius + " is " + myCircle.findArea());
  }
}
 
class Circle
{ 
  double radius = 1.0;
 
  double findArea()
  { 
    return radius*radius*3.14159;
  }
}


double radius = 1.0;

double findArea()

class Circle

all these above declaration do not have any acssses specifier(public, private,protected).. does it mean they are public by default??

 
in Java, there are three access modifiers: public, protected, and private BUT there are four access controls(default, public, protected, and private). Hence, if you do not specify them as "public", they are "default" by default - meaning they are not public. In short, the class is visible to other classes within the package level ONLY.


~za~
You can't bring back a dead thread!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top