How to new a class with args in Java?
constructor, java
Solution
There's no constructor with parameters:
public void Test(String name){}; //method with Test name
public Test(String name){}; //constructor
Problem
``` public class Test{ public void Test(String name){}; public static void main() { Test t=new Test("right"); } } ``` There is error in the above code when compile, could anyone tell me how to use the construct function with arg in Java?