Text and Numbers – Intro to Java Programming


It should print 12, and 3 plus 4 plus 5 with all the spaces. This might have been different from what you expected. We didn’t use quotation marks here. The quotation marks mark literal text. If we use quotes, it means that we want to write 3 plus 4 plus 5 as it is. But when we don;t use quotes, the computer reads 3 plus 4 plus 5 as numbers. It knows how to add the numbers, so it added the numbers and then it printed the result as you can see here. You can use system.out.println to print numbers and text

Leave a Reply

Your email address will not be published. Required fields are marked *