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: A lot of annoying cast errors.

  1. #1
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default A lot of annoying cast errors.

    My buildTree method might work but it seems to have several annoying cast errors.

    Somebody please help!

     

    Enter an expression.
    3+4+5
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Incompatible conditional operand types String and Double
    Cannot cast from StringBuffer to double
    Incompatible conditional operand types String and Character
    Cannot cast from StringBuffer to char
    Cannot cast from boolean to char
    Type mismatch: cannot convert from char to boolean
    Type mismatch: cannot convert from Character to OperatorNode
    Cannot cast from StringBuffer to char
    Cannot cast from StringBuffer to char
    Type mismatch: cannot convert from Character to OperatorNode
    Duplicate local variable c
    Cannot cast from StringBuffer to char

    at projectOfDoom.Expression_Tree.buildTree(Expression _Tree.java:72)
    at projectOfDoom.Test_Expression.main(Test_Expression .java:24)





    HELP!!!!
    Last edited by javapenguin; November 16th, 2010 at 08:11 PM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: A lot of annoying cast errors.

    Not everyone is following you other several posts where the code for this method may be listed. Please post the relevant code (and try to post only the relevant code). And SHOUTING things such as HELP won't speed anything up, and could completely turn off some who wish to help (eg its not very good forum behavior)
    Last edited by copeg; November 16th, 2010 at 08:18 PM.

  3. The Following User Says Thank You to copeg For This Useful Post:

    javapenguin (November 16th, 2010)

  4. #3
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: A lot of annoying cast errors.

    ok, what's wrong now?

    I figured that I need to have in-order traversal or something like this:

    public void inOrder()
    		{
    			if (left!=null)
    				left.inOrder();
    			System.out.println(data);			
    			if (right!=null)
    				right.inOrder();
    		}

    for the toString() method, but I don't know how I'd set that up.

    The build tree might work, if I could deal with all the cast exceptions.


    And btw, I meant that one thread as a practical joke.

    I was in a humorous mood. It often comes due to large amounts of stress needing to be relieved.

    That and I have ADHD and Aspergers and don't know proper social behavior, especially as my medicine wears off as the night goes on.

    Sorry.

    Wasn't trying to break the rules.

  5. #4
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: A lot of annoying cast errors.

    That and I have ADHD and Aspergers and don't know proper social behavior, especially as my medicine wears off as the night goes on.
    Sorry for the off-topic but, omg that is crazy. I was diagnosed with ADHD and Aspergers like 3 years ago. Fricken sucks man, I hate autism. What meds they have you on? I'm on Vyvanse, went from a C student to a Straight A student as soon as I started taking that.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  6. The Following User Says Thank You to aussiemcgr For This Useful Post:

    javapenguin (November 16th, 2010)

  7. #5
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: A lot of annoying cast errors.

    Ritalin I think.

  8. #6
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: A lot of annoying cast errors.

    Quote Originally Posted by javapenguin View Post
    Ritalin I think.
    Thats some rough shit. Although I think Vyvanse is known for pushing already stressed-out people over the edge. For me, it has just mellowed me out and just generally improved my quality of life and mood. It also works as one hell of a pain killer, which is great for my chronic spine disorder. Also non-addictive. I usually don't take my meds on weekends and I function just fine, just can't get as much done in a day. I don't take them on the weekends bc I've learned that if I don't have anything to keep myself occupied while on the meds, the day is like a never ending hell.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  9. #7
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: A lot of annoying cast errors.

    Are you guys going to help or just stare at the thread? I'm close to giving up. I'm so tired!


Similar Threads

  1. Typecasting of double variable to integer
    By JavaPF in forum Java Programming Tutorials
    Replies: 2
    Last Post: December 5th, 2010, 03:41 AM
  2. Getting errors
    By Nonire in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 4th, 2010, 12:21 PM
  3. Why am I getting 62 errors?
    By DestinyChick1225 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 1st, 2010, 04:41 AM
  4. annoying error.
    By gajamaflake in forum What's Wrong With My Code?
    Replies: 7
    Last Post: January 24th, 2010, 04:29 PM
  5. how to load a class and type cast to that class?
    By chinni in forum Object Oriented Programming
    Replies: 2
    Last Post: November 9th, 2009, 10:18 AM