Results 1 to 10 of 10
  1. #1
    sally mally is offline Member
    Join Date
    Nov 2013
    Posts
    14
    Rep Power
    0

    Default how to solve the problem of this error.. sorry im new here

    my codes.

    java codes:


    public abstract class Sayuran {

    private int berat;

    public Sayuran (int w) {

    berat = w; }



    public abstract double kiraBerat();

    public int kiraBerat() {

    return berat;

    }

    }



    class Kobis extends Sayuran {

    public Kobis (int w) {

    super (w);

    }

    public double kiraBerat() {

    return 5* super.kiraBerat();

    }

    }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: how to solve the problem of this error.. sorry im new here

    I don't know what the problem is as you haven't described it. However, you have defined kiraBerat() twice. You can't do that. Note: the return value does not distinguish methods, only the name and the parameters are part of the signature.

    Regards,
    Jim
    Last edited by jim829; 12-02-2013 at 04:19 AM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    sally mally is offline Member
    Join Date
    Nov 2013
    Posts
    14
    Rep Power
    0

    Default Re: how to solve the problem of this error.. sorry im new here

    i need to correct the errors based on that coding...
    and i dont know how to fixed the errors

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: how to solve the problem of this error.. sorry im new here

    Please copy the full text of the error message and paste it here. It has important info about the error.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    sally mally is offline Member
    Join Date
    Nov 2013
    Posts
    14
    Rep Power
    0

    Default Re: how to solve the problem of this error.. sorry im new here

    how to solve the problem of this error.. sorry im new here-error.png

    here the error....

  6. #6
    sally mally is offline Member
    Join Date
    Nov 2013
    Posts
    14
    Rep Power
    0

    Default Re: how to solve the problem of this error.. sorry im new here

    how to solve the problem of this error.. sorry im new here-error.png

    here the error..please help me

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: how to solve the problem of this error.. sorry im new here

    Images aren't any good for copying text from or for comparing spelling. Can you copy the text of the message and paste it here?

    See post#2 about having two methods with the same name. Change the name of one of them so they are different.

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    If you don't understand my response, don't ignore it, ask a question.

  8. #8
    sally mally is offline Member
    Join Date
    Nov 2013
    Posts
    14
    Rep Power
    0

    Default Re: how to solve the problem of this error.. sorry im new here

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Sal_Kentang>cd Desktop

    C:\Users\Sal_Kentang\Desktop>javac Sayuran.java
    Sayuran.java:13: error: method kiraBerat() is already defined in class Sayuran
    public int kiraBerat() {
    ^
    Sayuran.java:33: error: abstract method kiraBerat() in Sayuran cannot be accesse
    d directly
    return 5* super.kiraBerat();
    ^
    2 errors

    C:\Users\Sal_Kentang\Desktop>

  9. #9
    fizza is offline Member
    Join Date
    Dec 2013
    Posts
    1
    Rep Power
    0

    Default Re: how to solve the problem of this error.. sorry im new here

    u got a answer???? i'm want this answer..

  10. #10
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: how to solve the problem of this error.. sorry im new here

    I already told you the answer (see post #2).

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. how to solve the problem of this error
    By sally mally in forum Java Servlet
    Replies: 4
    Last Post: 11-29-2013, 11:06 AM
  2. Replies: 5
    Last Post: 05-09-2012, 06:18 PM
  3. I'm getting this java error, how do I solve it?
    By ThomasTrain in forum New To Java
    Replies: 1
    Last Post: 09-04-2011, 03:28 PM
  4. plz solve this error
    By silversurfer2in in forum AWT / Swing
    Replies: 14
    Last Post: 06-15-2010, 04:30 PM
  5. Help mi solve my error
    By Deon in forum New To Java
    Replies: 3
    Last Post: 01-11-2008, 06:26 AM

Tags for this Thread

Posting Permissions

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