Results 1 to 12 of 12
  1. #1
    ron2794 is offline Member
    Join Date
    Dec 2010
    Posts
    38
    Rep Power
    0

    Default Find the error in this and why this can't be ?

    public class class1 {
    private int i=3;
    private int j=1;
    public class1(){
    this.i=3223423;
    this.j=234234;
    just();
    }
    void just(){
    class1 c=new class1();
    c.i=32;
    }
    public static void main(String args[]){
    class1 e=new class1();
    System.out.print(e.j);
    }
    }

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    What do you think it is the error?

  3. #3
    ron2794 is offline Member
    Join Date
    Dec 2010
    Posts
    38
    Rep Power
    0

    Default

    yes, my netbeans is showing error

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Okay? So what do you think it is? I did not ask why you thought there was one, I asked you what you think it is.

  5. #5
    AcousticBruce is offline Senior Member
    Join Date
    Dec 2010
    Location
    Indiana
    Posts
    202
    Rep Power
    5

    Default

    Try putting more test points in your code like I added below and It will help you a lot.

    Run this code with and without the commented out test(). Do you see whats wrong now?


    Java Code:
    public class class1 {
    
         private int i = 3; 
         private int j = 1;
    
        public class1() {
            System.out.println("1st Test:");
            this.i = 3223423;
            this.j = 234234;
            just();
        }
        void just() {
            System.out.println("2nd Test:");
            [COLOR="Red"]//class1 c = new class1();
            //c.i = 32;[/COLOR]
            System.out.println("3rd Test:");
        }
    
        public static void main(String args[]) {
            class1 e = new class1();
            System.out.println("4th Test:");
        }
    }

    Hey man I am new to java and coding but I can tell your code is pretty
    confusing. Mainly because of the generic variable names. I know you got
    more creativity then that :) :) :)
    Last edited by AcousticBruce; 12-14-2010 at 11:35 AM.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    He's simply looking for homework answers (of the cut-n-paste type).

  7. #7
    AcousticBruce is offline Senior Member
    Join Date
    Dec 2010
    Location
    Indiana
    Posts
    202
    Rep Power
    5

    Default

    Hmm. lame.

    Well at least i got my practice :)

  8. #8
    ron2794 is offline Member
    Join Date
    Dec 2010
    Posts
    38
    Rep Power
    0

    Default Not a homework assignment

    Dear Masjide, or whatever you are,,,,,,

    first of all let it make it absolutely clear that this is not a homework assignment, i study in a school and i am just 16 now and bcz of my passion in java and interest in java i am studying it i am studying all possible ebooks, getting into more and more forums so that i can get more..................

    otherwise at this age student are mad abt giving the entrance exams like SAT but i DON"T ,,,,,,...........
    and for your kind information they do not give us any homework in school especially of that kind. i haven't studied abt the recursive nature of java in school, nor abt multithreading etc. i was asking bcz it interests me and i like JAVA,......................

    Java Code:
    int i=0;
    while(i=0){
    System.out.println("i need answers , not your comments ! UNDERSTAND ?");
    }

  9. #9
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Okay? So you still haven't answered the question. What do you think the problem is (not that I believe any part of that rant)?

  10. #10
    AcousticBruce is offline Senior Member
    Join Date
    Dec 2010
    Location
    Indiana
    Posts
    202
    Rep Power
    5

    Default

    Hey Ron, that is no way to win here. If someone made a mistake, oh well, dont take it personal.

    BTW I spent a good amount of MY time helping YOU out. Did you not even bother reading my post?

  11. #11
    ron2794 is offline Member
    Join Date
    Dec 2010
    Posts
    38
    Rep Power
    0

    Default for acoustic

    ya i read you post, now i know that it was a stackoverflow in my memory...............
    i was sying that to msjide

  12. #12
    ron2794 is offline Member
    Join Date
    Dec 2010
    Posts
    38
    Rep Power
    0

Similar Threads

  1. Can't find error in my program!
    By kkGG in forum New To Java
    Replies: 2
    Last Post: 11-10-2010, 06:38 PM
  2. I need help with an error! Cannot find symbol error!
    By ambria1975 in forum New To Java
    Replies: 2
    Last Post: 07-07-2010, 02:37 AM
  3. Cannot find symbol error
    By rajivjoshi in forum New To Java
    Replies: 3
    Last Post: 05-31-2010, 11:13 AM
  4. 'Cannot find symbol' error
    By minihazard10 in forum New To Java
    Replies: 6
    Last Post: 10-10-2008, 05:05 AM
  5. Error: cannot find symbol
    By silvia in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:39 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
  •