Results 1 to 4 of 4

Thread: How to pass arguments to the main method

  1. #1
    Join Date
    Dec 2008
    Posts
    87

    How to pass arguments to the main method

    How to pass arguments to the main method, What is the meaning of supplying string[] args to main method? Is there any different thing that we need to consider while passing arguments to the main method.

  2. #2
    Join Date
    Feb 2008
    Posts
    129

    Re: How to pass arguments to the main method

    In C#, value types (like int, double, byte and structs) are passed by value, by default. This means that the receiving method has a NEW instance of the type. Select Run menu, Click Open Debug Dialog, Click Arguments tab and give your arguments there. If an int that has a value of 1 is passed to the method, and the method changes it to 2, this change is only reflected within the method, the calling location's int is still 1.

  3. #3
    Join Date
    Feb 2008
    Posts
    129

    Re: How to pass arguments to the main method

    In C#, value types (like int, double, byte and structs) are passed by value, by default. This means that the receiving method has a NEW instance of the type. Select Run menu, Click Open Debug Dialog, Click Arguments tab and give your arguments there. If an int that has a value of 1 is passed to the method, and the method changes it to 2, this change is only reflected within the method, the calling location's int is still 1.

  4. #4
    Join Date
    Mar 2008
    Posts
    192

    Re: How to pass arguments to the main method

    Your questions isn't clear, but I'd like to point out that in C#, objects are passed by reference by default. Once you compile your new class, with the main() method that you want, you can add it to the jar file -- this is done by extracting the jar, adding your class, and recreating the jar fileMeaning, if you have an object, and then pass that object on to a method that makes changes to that object, those changes will affect the object in your calling code as well, since they both reference the same object.

Similar Threads

  1. what are the possible return types of a main method?
    By \"Dritan\" in forum Software Development
    Replies: 3
    Last Post: 08-01-2011, 03:50 AM
  2. Explain main method in java
    By Angelica Maria in forum Software Development
    Replies: 5
    Last Post: 10-03-2010, 01:18 PM
  3. String in the method arguments
    By DANIEL 602 in forum Software Development
    Replies: 3
    Last Post: 29-12-2009, 02:21 PM
  4. Variable method arguments in Csharp
    By KAMANA in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 05:57 PM
  5. How to pass runtime arguments to JAVA Application
    By Nihar Khan in forum Software Development
    Replies: 2
    Last Post: 30-03-2009, 01:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,908,730.53324 seconds with 16 queries