Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-09-2009
Member
 
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.
Reply With Quote
  #2  
Old 12-09-2009
Member
 
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.
Reply With Quote
  #3  
Old 12-09-2009
Member
 
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.
Reply With Quote
  #4  
Old 12-09-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 10:20 PM.