Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 28th, 2008, 06:37 AM
Supura Supura is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 3 Supura User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 16 m 33 sec
Reputation Power: 0
Problem Object with array

hi all
I have a problem with my object
i send array in object and its return me
this msg error :

Code:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at masteracobjet.Mastermind.prop(Mastermind.java:83)
        at masteracobjet.Main.main(Main.java:48)
Java Result: 1



in my object in the method :

Code:
public void proposi(int [][] inProposi,int n,int nbP)
{
      
  int[][] prop = new int[n][nbP+2];

}


thanx for your help

Last edited by Supura : March 4th, 2008 at 08:42 AM. Reason: formatage (code tags)

Reply With Quote
  #2  
Old March 3rd, 2008, 12:55 AM
salmanumar007 salmanumar007 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: london
Posts: 1 salmanumar007 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 26 sec
Reputation Power: 0
Send a message via AIM to salmanumar007 Send a message via MSN to salmanumar007 Send a message via Yahoo to salmanumar007
MySpace
help

i also geting this problem plz any one help

Reply With Quote
  #3  
Old March 4th, 2008, 03:14 PM
paulscode's Avatar
paulscode paulscode is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: Fort Meade, MD
Posts: 77 paulscode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 51 m 4 sec
Reputation Power: 3
There doesn't appear to be anything wrong with the code you posted here. It complied and ran fine with no exceptions when I used your class, and then created a new "proposi" like this:
Code:
proposi myProposi = new proposi( new int[1][2], 3, 4);

Judging from the error you are getting, I suspect the problem is in how you are accessing your proposi after creating it. It could be something like a zero-based issue. If you haven't solved this problem yet, could you post the code you are using to access your object?

Reply With Quote
  #4  
Old March 5th, 2008, 03:20 AM
Supura Supura is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 3 Supura User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 16 m 33 sec
Reputation Power: 0
Code:
    int  [][]  TabP=new int[nbE][nbP];
    
    String resu="";
//////////////////////////////////////////////////////////////////
    
    Mastermind Master=new Mastermind();
   
    Master.couleur(nbC);
    Master.essai(nbE);
    Master.taille(nbP);
    Master.soluce(nbC, nbP);    
    Master.marke(tabMarkeur);
    Master.proposi(TabP[][],nbE,nbP);


this is the part in my MAIN to access to Proposi for give the sizes of the array

thanks for your help

Reply With Quote
  #5  
Old March 5th, 2008, 08:01 PM
paulscode's Avatar
paulscode paulscode is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: Fort Meade, MD
Posts: 77 paulscode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 51 m 4 sec
Reputation Power: 3
The problem is a syntax error in the line:
Code:
Master.proposi(TabP[][],nbE,nbP);

Depending on what you are trying to do here, I think you want this line to be:
Code:
Master.proposi(TabP, nbE, nbP);

Also, if you look at the "proposi" method, all it does is create a new int[][] called "prop", and then it exits without doing anything (it disregards "prop" without using it).

What do you want the "proposi" method to actually do?

For example, IF you want it to change the int[][] you are passing to it, then it should look like this:
Code:
    public proposi( int [][] inProposi,int n,int nbP )
    {
        int[][] prop = new int[n][nbP+2];
        inProposi = prop;
    }

It all just depends on what want that method to actually do.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Problem Object with array


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek