PLEASE HELP. Hi I get the following error when I compile my java code and I have been trying to resolve this for past 4 hours without a solution.
Java code
import java.util.*;
/**********************/
/* Class Subscriber */
/**********************/
public class Subscriber implements Runnable {
String phoneNumber;
String name;
Integer balanceInCents;
Integer decrementRate;
String threadSelection;
String operationSelection;
// create Subscriber Error object E
SubscriberError E;
List subscriberList;
Subscriber currentSubscriber;
String curPhoneNumber;
String curName;
/* Class constructor */
public Subscriber(String threadType, List s) {
this.phoneNumber = "";
this.name = "";
this.balanceInCents = 0;
this.decrementRate = 0;
this.E = new SubscriberError();
this.subscriberList = Collections.synchronizedList(new ArrayList(Subscriber)) ;
this.subscriberList = s;
this.threadSelection = threadType;
}
/* Class constructor specifying phone number, name, balance in cents and decrement rate cents per minute */
public Subscriber(String p, String n, Integer b, Integer d) {
this.phoneNumber = p;
this.name = n;
this.balanceInCents = b;
this.decrementRate = d;
this.E = new SubscriberError();
}
/***********************************************/
/* method isNumber : class Subscriber */
/***********************************************/
// Check if given string is a number (digits only)
public static boolean isNumber(String string) {
return string.matches("^\\d+$");
}
/***********************************************/
/* method addSubscriber : class Subscriber */
/***********************************************/
public Integer addSubscriber(String p, String n, Integer b, Integer d) {
if ((p.length() != 10) || !(isNumber(p))) {
E.errorCode = 100;
E.errorMessage = "Invalid Subscriber Definition!";
return E.errorCode;
}
else {
Subscriber newSubcriber = new Subscriber("p","n",b,d) ;
synchronized (this) {
if (!subscriberList.contains(newSubscriber)) {
subscriberList.add(newSubscriber);
E.errorCode = 0;
E.errorMessage = "Success";
notifyAll();
return E.errorCode;
} /* if (!subscriberList.contains( */
else {
E.errorCode = 400;
E.errorMessage = "Subscriber already exists!";
notifyAll();
return E.errorCode;
} /* else */
} /* synchronized (this) */
} /* else */
} /* public Integer addSubscriber */
/**************************************************************************************************/
/* Method run: class Subscriber. Thread method to provide subscriber operations menu to the user */
/**************************************************************************************************/
@Override
public void run() {
} /* public void run() */
} /* class Subscriber extends Runnable */
THIS IS THE ERROR I GET:
C:\java\TMobile>javac -Xlint Subscriber.java
Subscriber.java:28: cannot find symbol
symbol : variable Subscriber
location: class Subscriber
this.subscriberList = Collections.synchronizedList(new ArrayList(Subscri
ber)) ;
^
Subscriber.java:28: warning: [unchecked] unchecked conversion
found : java.util.ArrayList
required: java.util.List<T>
this.subscriberList = Collections.synchronizedList(new ArrayList(Subscri
ber)) ;
^
Subscriber.java:28: warning: [unchecked] unchecked method invocation: <T>synchro
nizedList(java.util.List<T>) in java.util.Collections is applied to (java.util.A
rrayList)
this.subscriberList = Collections.synchronizedList(new ArrayList(Subscri
ber)) ;
^
Subscriber.java:66: cannot find symbol
symbol : variable newSubscriber
location: class Subscriber
if (!subscriberList.contains(newSubscriber)) {
^
Subscriber.java:67: cannot find symbol
symbol : variable newSubscriber
location: class Subscriber
subscriberList.add(newSubscriber);
^
3 errors
2 warnings
C:\java\TMobile>