Skip to main content
Used String type instead of string
Source Link
Pascal Thivent
  • 571.8k
  • 140
  • 1.1k
  • 1.1k

You can, if you pass args to the constructor:

public class Program
{
    private stringString foo;
    private stringString bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    }

    private void run()
    {
        // whatever
    }
}

You can, if you pass args to the constructor:

public class Program
{
    private string foo;
    private string bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    }

    private void run()
    {
        // whatever
    }
}

You can, if you pass args to the constructor:

public class Program
{
    private String foo;
    private String bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    }

    private void run()
    {
        // whatever
    }
}
added 77 characters in body
Source Link
Jon Skeet
  • 1.5m
  • 892
  • 9.3k
  • 9.3k

You can, if you pass args to the constructor:

public class Program
{
    private string foo;
    private string bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    } 

    private void run()
    {
        // whatever
    }
}

You can, if you pass args to the constructor:

public class Program
{
    private string foo;
    private string bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    }
}

You can, if you pass args to the constructor:

public class Program
{
    private string foo;
    private string bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    } 

    private void run()
    {
        // whatever
    }
}
Source Link
Jon Skeet
  • 1.5m
  • 892
  • 9.3k
  • 9.3k

You can, if you pass args to the constructor:

public class Program
{
    private string foo;
    private string bar;

    public static void main(String[] args) 
    {
        Program program = new Program(args);
        program.run();
    }

    private Program(String[] args)
    {
        this.foo = args[0];
        this.bar = args[1];
        // etc
    }
}