hi I'm new to java and I've been trying to pass an int form main method to a constructor in another class but there is some kind of error occurring. I can't understand what i did wrong.
class with the main method :
import java.util.Scanner;
public class _01 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter your : ");
String name = input.nextLine();
int size = name.length();
//System.out.println(size);
_02 process = new _02(size);
}
}
class that has the constructor:
public class _02 {
int maxsize;
int top;
String arrayStack[];
public void _02(int size) {
maxsize = size;
arrayStack = new String[maxsize];
top = -1;
}
public void push(String... letters) {
arrayStack[++top] = letters;
}
public String pop() {
return arrayStack[top--];
}
}
error message i'm getting :
Exception in thread "main" java.lang.Error: Unresolved compilation problem: The constructor _02(int) is undefined
at _01.main(_01.java:16)