I have a class Logistic in package sequence
package sequence;
class LogisticSeq {
int limit;
double lamda;
ArrayList <Double> lseq = new ArrayList <Double>();
LogisticSeq(int a, double b, double c) {
limit = a;
lseq.add(b);
lamda = c; }
void sequence() throws IOException{
File file = new File("Sequence.txt");
if (!file.exists()) {
file.createNewFile();
}}
public class Logistic {
public static void main (String[] args) throws IOException {
LogisticSeq L = new LogisticSeq(50,0.4999,3.9999);
L.logisticsequence();
}
How to access the class LogisticSeq from class in other package
You state:
@Hovercraft Full Of Eels I tried to change it to public but i got the error in eclipse and says to define it in its own file.
It sounds like you've either got your LogisticSeq class in a file that holds multiple classes or else do not have your class/package name matching your project's package/file structure.
I suggest that you do just what the Java compiler tells you to: Create a LogisticSeq.java file in the sequence package and make sure that the class is public.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.