• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java and ("Expected: " + Value) seeking good resource to explain what this is used for  RSS feed

 
M. Lewis
Greenhorn
Posts: 2
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I am taking a Graduate Level Java Course which is basically saying, I am in Graduate School and know very little about Java.
So this week, there are several example of System.out.println("Expected: " + value) or something like this. I have no idea what this is saying, trying to say or attempting to communicate.
Any carbon based life-form resource would be greatly, greatly appreciated. Just understanding why I would use this and how it would help me or someone would be helpful?

Thank you in advance,

Mike Lewis
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Nothing carbon‑based, I am afraid. Even the mindprod error message glossary is silicon‑based.

A common reason for such an error message is using the assignment operator = instead of the equality sign ==. The traditional equality sign is = but they used == for historical reasons.
 
M. Lewis
Greenhorn
Posts: 2
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ANSWER: So, what has been revealed on this issue.

The "Expected: " value is used to compare against the actual value in a Tester Program that you write via a Class to compare values.

Literally, it is a String value that you use to compare when you start learning Java that prints out and compares against the actual value that you print out as well.

Example: System.out.println("Expected: " calculated by hand value");
Compared to: System.out.println("Actual: " + value")

Problem is, it's a String so I would have to write a helpful function for it to be of use.

More to come as this method of checking values and testing Java Code continues in my next Project. Take Care everyone.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!