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

Thread: My code have a simple error but i dont know how to solve it !!!

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default My code have a simple error but i dont know how to solve it !!!

    ImageShack® - Online Photo and Video Hosting

    Imageshack - erronobluej.jpg

    ==========================//====================

    public class Bhaskara {
    int a;
    int b;
    int c;
    int d;
    double x;
    double x2;
    public Bhaskara () {
    a=1;
    b=1;
    c=1;
    d=1;
    }
     
     
    public void seta ( int a );
    { 
    valor_a=a;
     
    }
     
    public void setx ( double x );
    {
    valor_x=x;
    }
     
    public void setx2 ( double x2 );
    {
    valor_x2=x2;
    }
     
     
    public void setb ( int b );
    {
    valor_b=b;
     
    }
     
    public void setc ( int c );
    {
    valor_c=c;
     
    }
     
    int d = b*b- (4*a*c);
     
    void apply () {
    if (d = 0)
           public double xvalue;
           x = -b + Math.pow (d;1/2)/2*a;
           return x;
     
     
     
    else (d < 0) 
    public staticm void main ( string args [] ) {
        System.out.println ("There'so possible answer");
    }
     
    else ( d > 0 )
    public double xvalue;
    x = -b + Math.pow (d;1/2)/2*a;
    return x;
    public double x2value;
    x2 = -b - Math.pow (d;1/2)/2*a;
    return x2;
    }


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: My code have a simple error but i dont know how to solve it !!!

    Those images are too small to see the errors.

    What seems to be the problem exactly? Please give us as much detail as possible.

    Looking at the code, I can see lot's of errors straight away. I suggest going back to basics - The Java™ Tutorials

    My first hint would be to look at the methods.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My code have a simple error but i dont know how to solve it !!!

    void apply () {
    if (d = 0)
           public double xvalue;
           x = -b + Math.pow (d;1/2)/2*a;
           return x;
    The error says : " illegal start of expression " in public double x value

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: My code have a simple error but i dont know how to solve it !!!

    Like I said, there are lots of errors in your code.

    • Your methods are wrong. Delete ;
    • d is a duplicate variable.
    • valor_a, valor_b etc are undefined.


    Plus x = -b + Math.pow (d;1/2)/2*a; is completely wrong.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My code have a simple error but i dont know how to solve it !!!

    Im using BlueJ.... i think its kinda different

  6. #6
    Member Java Neil's Avatar
    Join Date
    Jan 2011
    Posts
    72
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: My code have a simple error but i dont know how to solve it !!!

    Different from what? The syntax is the same, right?

  7. #7
    Junior Member
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My code have a simple error but i dont know how to solve it !!!

    Quote Originally Posted by Java Neil View Post
    Different from what? The syntax is the same, right?

    im not sure, it just shoed that error and that i should put ; at the end of each command

Similar Threads

  1. Replies: 4
    Last Post: August 10th, 2011, 11:16 AM
  2. i'm getting this error, dont know why? please help
    By amr in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 17th, 2010, 05:14 AM
  3. WHY this code dont work?
    By sibbe in forum Java Theory & Questions
    Replies: 7
    Last Post: December 9th, 2010, 09:47 AM
  4. Simple code error
    By robin28 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 7th, 2010, 02:25 PM
  5. help me out with the following code to solve the error
    By romilc in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 11th, 2009, 03:45 AM