Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Hardcoding arguments for public static void main (String args[ ])

$
0
0
Hi,

First of all apologies for the newbie question

I am looking to pass a string argument ("localhost") to main by hardcoding without using the debug config inside my IDE. I want to change the following code to do so:

Code:
public static void main (String args[])
{
 if args.length>0)
  {
   DateClient theApp =  new DateClient(args[0]);
   
   try
   {
   ...more code...



How do I do this? I tried delcaring a string "localhost" and setting it to args[0], but that doesn't work.

Thank You in advance.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>