Write the definition of a class Telephone . The class has no constructors, one instance variable of type String called number , and two static variables. One is of type int called quantity ; the other is of type double called total . Besides that, the class has one static method makeFullNumber . The method accepts two arguments, a String containing a telephone number and an int containing an area code. The method concatenates the two arguments in the following manner: First comes the area code, then a dash, then the telephone number. The method returns the resultant string.
the code i wrote :
==============
class Telephone{
String number ;
static int quantity;
static double total;
static String makeFullNumber(){
return quantity+"- "+n;
}
}
========
i don't how come it can't find the makeFullNumber ?
Last edited by chihwei; Jun 11th, 2007 at 11:14 pm.
Writing "public " (Access- Modifiers ) , is not the error here .The class can be written with out it and it will be friendly by default (Can be Accessed inside the same package ) ??
"you don't understand..." it is not good to say that for a one u don't know anything about him , just the user name . and the questions marks it was my mistake , and as u see also i put big wondering notations,
Write the definition of a class Telephone . The class has no constructors, one instance variable of type String called number , and two static variables. One is of type int called quantity ; the other is of type double called total . Besides that, the class has one static method makeFullNumber . The method accepts two arguments, a String containing a telephone number and an int containing an area code. The method concatenates the two arguments in the following manner: First comes the area code, then a dash, then the telephone number. The method returns the resultant string.
it's an instance variable, add private before you declare String
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.