Home java Working with the command line in Intellij Idea

Working with the command line in Intellij Idea

Author

Date

Category

I have such a class:

Public Class Solution {
  Public Static List & Lt; Person & GT; Allleople = New ArrayList & LT; Person & GT; ();
  static {
    Allleople.DDD (Person.Createmale ("Ivanov Ivan", new date ())); // Today was born id = 0
    allpeople.DDD (Person.Createmale (Petrov Peter, New Date ())); // Today was born id = 1
  }
  Private Static Person Getperson (String Name, String Sex, String BD) Thrown ParseException {
    Person Person = NULL;
    SimpleDateFormat SimpleDateFormat = New SimpleDateFormat ("DD / MM / YYYY", Locale.English);
    if (sex.equals ("M")) person = person.createmale (name, simpledateformat.parse (bd));
    Else Person = Person.CreateFemale (Name, SimpleDateFormat.Parse (BD));
    Return Person;
  }
  Public Static Void Main (String [] Args) Thrown ParseException {
    // Start Here - Start here
    if (args [0] .equals ("- C")) {
      Person Person = GetPerson (Args [1], Args [2], Args [3]);
      Allpeople.add (Person);
    } ELSE if (args [0] .equals ("- U")) {
      Person Person = GetPerson (Args [2], Args [3], Args [4]);
      int id = integer.valueof (args [1]);
      allpeople.remove (id);
      allpeople.add (ID, Person);
    } ELSE If (args [0] .equals ("- D")) {
      allpeople.remove (integer.valueof (args [1]);
    } ELSE if (args [0] .equals ("- I")) {
      Person Person = Allpeople.get (Integer.Valueof (Args [1]));
      System.Out.printLN (Person.GetName () + "" + person.getsex () + "" + person.getbirthday ());
    }
  }
}

My program on the input accepts arguments from the command line. How to run a program with arguments in Intellij IDEA? Do not collect me every time jar for checking ….


Answer 1, Authority 100%

RUN / DEBUG – & GT; Edit Configuration.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions