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.

the question is how you make it print it like that (66+3 = 69). I've posted the way i have written it.
I have written the rest of the code such as getting the input etc. I only need to know you make it print numbers like that?

Re: Need help with Java assignment

how you make it print it like that (66+3 = 69)

The data types of the variables will determine how the compiler processes the + operand.
It they are numeric (like int): 6 + 7 will return 13. If Strings: "6"+"7" will return "67"
If you want the + to be included in the String enclose it in "s: "+"

Can you post the code you are working with and the output that it creates to show the problem.
Also post what you want the output to be.

Re: Need help with Java assignment

66+3 = 69

To get that to print out you need to print 5 different Strings:
66
+
3
=
69

You can build the full String to be printed by using the + operator to concatenate the individual Strings into a single String.
Try printing this: 4 + "+" + 5
It has three parts:
4
+
5
that are concatenated into one String with the + operator.