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 2 of 2

Thread: problem

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem

    hello,
    i need aome help, the code i worte dosn't work and i don't know why...
    the code gose like this:
    public class RGBImage
    {
    public RGBImage(int rows, int cols)
    {
    for (int i = 0 ; i < rows ; i++)
    {
    for(int j = 0 ; j < cols ; j++)
    {
    RGBColor[][] pixel = new RGBColor[i][j];//RGBColor class i worte like a week before
    }
    }
    }

    public RGBImage (RGBColor pixel[][])
    {
    for (int i = 0 ; i < pixel.length ; i++)
    {
    for(int j = 0 ; j < pixel[].length ; j++)//at this point the compiler dosen't work, and i don't know why
    {
    pixel[i][j] = this.pixel[i][j];
    }
    }
    }
    }
    why can't i use here in length method? after all its arry...
    thankes


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,104
    Thanks
    52
    Thanked 2,285 Times in 2,256 Posts

    Default Re: problem

    Please explain what the code does. "doesn't work" is hard to fix without some details.
    If you get error messages, copy the full text of the error messages and paste it here.


    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: January 5th, 2012, 12:44 AM
  2. [SOLVED] [Problem] imports javax.swing problem
    By Brollie in forum AWT / Java Swing
    Replies: 8
    Last Post: July 5th, 2009, 07:59 AM