Simple combination

Report a typo

Look at this code:

String name = "galactic hunter";
String learning  = "java";
String combinedString = name + " learning " + learning;
System.out.println(combinedString);

We have a string combinedString in which strings and variables are combined using the + operator. Your task is to rewrite the code using printf or format. The output mustn't change.

Sample input:

Sample output:

galactic hunter learning java

Sample Input 1:

Sample Output 1:

galactic hunter learning java
Write a program in Java 17
public class Main {
public static void main(String[] args) {
String name = "galactic hunter";
String learning = "java";
//write your code below

}
}
___

Create a free account to access the full topic