Page 2 of 2 FirstFirst 12
Results 21 to 28 of 28
  1. #21
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    And if you want to send me back to the basics of syntax from here great but at least put a lead to the website for reference don't just leave me hanging with nowhere to look.K.O?

  2. #22
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    There is another coding technique that I think you should master, and I'm not sure what it's called, perhaps coding by progressive iteration, but it goes something like this:

    1) Create a class skeleton such as,
    Java Code:
    public MyClass {
    
    }
    2. Make sure that your current code compiles without error. If there's an error, fix it immediately before moving on. Then
    3. Add one line of code.
    4. Repeat steps 2. and 3. until program is complete.

    The key is to compile and debug frequently and early during your program creation process. If you do this, you will keep errors down to a manageable number. If not, you'll end up with, well what you have now: a hornet's nest of errors. Best of luck.

  3. #23
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    There's no need to throw personal insults around. The fact is you've been asking questions here for weeks. Every time we tell you what's wrong you seem to ignore us. Every time we direct you to tutorials or other on-line resources you appear to learn nothing. Every time we fix your code for you, you make exactly the same mistake somewhere else.

    Your latest error dump is the same as most of the others - misplaced curly brackets and a complete failure to comprehend classes and methods. Now good day to you.
    Last edited by OrangeDog; 06-03-2009 at 11:21 PM.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  4. #24
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,930
    Rep Power
    19

    Default

    OK, I'll format your code for you, which might point you in the right direction.

    Java Code:
    public static class ProductWithLength // definition of class
    {// line 179
        ProductWithLength[] length = new ProductWithLength[numItems];
    }
    
    for (int i=0; i<10000;  i++)// line 186
    {
        returnVal[i] = inventory[i];
    }
    Your for loop is not in a method, for starters...it's not even in the ProductWithLength class.
    Your ProductWithLength class makes no sense...static is not a legal modifier for a class.
    Is this "class" defined in your Inventory class?

    I shall say again, take a step back...restructure your code as I said above...stop thrashing.

    You need to think about what you're trying to do here with your (presumably) Inventory class...I haven't a clue. And no, "trying to get the for loop to work" is not an answer to that question.

  5. #25
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default Classes about classes

    tlouvierre... Like Fubarable & Tolls indicate, you need to study about classes:

    What Is a Class? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)
    Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
    Creating Objects (The Java™ Tutorials > Learning the Java Language > Classes and Objects) (see section about class instantiating)

    Generally, (like some else commented) classes are usually not imbedded inside another class (nested classes). It's usually is a separate file and it's methods are called by other classes (if needed) by instantiating the class. For example:

    Java Code:
    MyClass mc = new myClass();//instanciating the class
    int myInt = mc.myMethod();//calling a method of that class
    Now on a separate note... please stop being offended when somebody criticizes you (either positive or negative). If you get upset everytime somebody says something you don't like, you will always be upset with the rest of the world. Learn from both the positive and negative comments.

    Luck,
    CJSL
    Last edited by CJSLMAN; 06-05-2009 at 01:57 AM. Reason: typo
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  6. #26
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default Quote Quote

    Quote Originally Posted by OrangeDog View Post
    There's no need to throw personal insults around. The fact is you've been asking questions here for weeks. Every time we tell you what's wrong you seem to ignore us. Every time we direct you to tutorials or other on-line resources you appear to learn nothing. Every time we fix your code for you, you make exactly the same mistake somewhere else.

    Your latest error dump is the same as most of the others - misplaced curly brackets and a complete failure to comprehend classes and methods. Now good day to you.
    Every bit of information that you supplied which is only for methods turned out that I don't need. Because the line is wrote as a class. It is the only thing that fits and fits well. I guess you did not see my update. And I do have a problem with classes with and methods because I don't recognize them. I read the literature but as I said it was for the wrong the class and not the method like I tought it was. You have to admit that it looked like a method being wrote at first and then when applied class the error went away after I had made several other changes too. Can you give information on for loops and classes, please?:)

  7. #27
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default Read carefully....

    Can you give information on for loops and classes, please?
    tlouvierre... you must read the posts carefully... above, I already posted 3 links to help you with understanding classes. Here are some for loops:

    The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)
    The while and do-while Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  8. #28
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 21
    Last Post: 06-01-2009, 12:52 PM
  2. Replies: 1
    Last Post: 05-31-2009, 06:48 PM
  3. Replies: 16
    Last Post: 05-28-2009, 03:41 PM
  4. java:34:cannot find symbol
    By MissyMadi in forum New To Java
    Replies: 5
    Last Post: 11-09-2008, 06:53 PM
  5. [SOLVED] Java Error: Cannot find Symbol...
    By bobleny in forum New To Java
    Replies: 8
    Last Post: 04-15-2008, 06:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •