Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how to assign values to (args) from Jcreator

  1. #1
    Member
    Join Date
    Nov 2010
    Posts
    40
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default how to assign values to (args) from Jcreator

    hi
    how to assign values to (args) from Jcreator

    public static void main(String [] args)
    {
     
    	double radius;
     
    	if (args.length > 0)
    	{
    	  Circle3 []c1 =new Circle3[(args.length)-1];
    	        for (int i=0;i<args.length;i++)
    	        {
    	        	 c1[i] = new Circle3(Double.parseDouble(args[i]));
    	        	 System.out.println("obj("+(i+1)+").Area= "+c1[i].area());
      	             System.out.println("obj("+(i+1)+").Circumferance= "+c1[i].circum());
      	             System.out.println("obj("+(i+1)+").Diameter= "+c1[i].diam());
    	        }
    	}


  2. #2
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: how to assign values to (args) from Jcreator

    Go to run configurations and then to arguements. That'll get it from Eclispe. not sure from JCreator.

  3. #3
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: how to assign values to (args) from Jcreator

    The way it is now , your for loop will run out of bounds at the invalid index of args.length.

    Circle3 []c1 =new Circle3[(args.length)-1];

    should be

    Circle3[] c1 = new Circle3[args.length];

    the number in the brackets is the number of elements.

    The way it is, your for loop will run out of bounds at the invalid index of args.length.

Similar Threads

  1. How To Make JCreator Output in a Command Window
    By Kimimaru in forum Java Theory & Questions
    Replies: 4
    Last Post: October 4th, 2010, 10:36 PM
  2. Junk values
    By abhilash.naik in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: September 9th, 2010, 07:25 AM
  3. Able to set, but not get values
    By Simple in forum What's Wrong With My Code?
    Replies: 18
    Last Post: June 23rd, 2010, 05:01 PM
  4. [SOLVED] Create a calculator with JCreator
    By Delmi in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 31st, 2010, 10:20 AM
  5. How to assign values from a file to an arraylist of objects?
    By nadman123 in forum Collections and Generics
    Replies: 3
    Last Post: September 15th, 2008, 02:07 PM