◎★Jû ] khuen FJKLC6unhqtwxAop√∵ ←→ ← |
F you can add strings to numbers?" "Yes, but remember that when you add strings and numbers, the result is always a string." F To display something on the screen, we use a System.out.println() command, and we pass whatever we want to print as an argument. Exercise:
![]()
Write a program that displays "Ellie is clever" 5 times. Each time, on a new line.public class Solution { public static void main(String[] args) { String message = "Ellie is clever";
System.out.println(message); System.out.println(message); System.out.println(message); System.out.println(message); System.out.print(message); } } public class Solution { public static void main(String[] args) { System.out.println("3118"); } } Write a program that declares the following variables in the main method: public class Solution { public static void main(String[] args) { String name; int age; String city; } }
|