Can't understand textbooks question and there is no solution to view?
Hi everyone,
I'm new to the JAVA programming language and have recently begun teaching myself the fundamentals by following a book called Java: How To Program (7th edition) by Deitel. I'm at the end of Chapter 2 and I am stumped on a question that for some reason has no solution in the book. The earlier bits of the Chapter Review showed answers to the questions so I could at least compare.
Anyway here is the question -- could anyone tell me what it is asking for?
Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space. Write a program using the following techniques:
a) Use one System.out.println statement.
b) Use four System.out.print statement.
c) Use one System.out.printf statement.
Here are my answers ... but I am still unsure.
Code:
a) System.out.println("12 34");
b) System.out.print("1");
System.out.print("2 ");
System.out.print("3");
System.out.print("4");
c) System.out.printf("%d%d %d%d",1,2,3,4);
Any help is appreciated, thanks.