what goes in main()


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: what goes in main()

  1. #1
    Join Date
    Oct 2008
    Posts
    4

    what goes in main()

    ~~
    Last edited by nullman; 10-12-2008 at 03:32 PM.

  2. #2
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    doesn't come close to working.
    Do you get a compile time error?

    Perhaps if you add: new to call the constructor for IRS, it would.

    That's all you need in the main() method, something to start the program.

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    ~~
    Last edited by nullman; 10-12-2008 at 03:32 PM.

  4. #4
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    Add some
    System.out.println("here I am, x= " + x);
    statements in the code to show where and what is happening

    What happens after the constructor is called?

  5. #5
    Join Date
    Oct 2008
    Posts
    4
    I'm sorry, I don't understand what you're asking me

  6. #6
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    You need to read your textbook about what a constructor is and when it is executed. Your program has 2 constructors. You call one of them in the main() method. What happens when it is executed. How does any other part of the program get executed?

    Add something like the following after every line in your program
    System.out.println("here I am, x= " + x);
    to show where and what is happening

  7. #7
    Join Date
    Oct 2008
    Posts
    4
    Code:
    	public static void main(String[] args)
    	{
    	    IRS irs = new IRS();
    	    irs.inputData();
    	    irs.printData();
    	}
    thanks for the help, Norm

Similar Threads

  1. Replies: 5
    Last Post: 12-22-2009, 08:35 AM
  2. Reference main form from a dialog form
    By leebarnard in forum VB Classic
    Replies: 1
    Last Post: 09-27-2006, 02:31 PM
  3. Window Disappears after Sub Main() exits
    By jim12345 in forum .NET
    Replies: 1
    Last Post: 07-26-2006, 02:50 PM
  4. Replies: 5
    Last Post: 02-03-2006, 07:58 PM
  5. problem with main() method
    By Vikas Babbar in forum Java
    Replies: 1
    Last Post: 08-01-2000, 03:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center