instantiate class with arguments
in
Integration and Hardware
•
2 years ago
How to instantiate a class with argument in processing?
for eg.,
public class Grid extends PApplet
{
public Grid()
{
}
public Grid(String fileName)
{
}
static public void main(String args[])
{
PApplet.main(new String[] {"--present", Grid}) ;
}
}
How to call the constructor with parameters?
for eg.,
public class Grid extends PApplet
{
public Grid()
{
}
public Grid(String fileName)
{
}
static public void main(String args[])
{
PApplet.main(new String[] {"--present", Grid}) ;
}
}
How to call the constructor with parameters?
The statement
PApplet.main(new String[] {"--present", Grid}); will call the default constructor.
But how can I call the constructor Grid(String) ?
1