java print variable in string code example
Example 1: java how to print a string[]
String[] array = new String[] {"John", "Mary", "Bob"};
System.out.println(Arrays.toString(array)); // [John, Mary, Bob]
Example 2: java print text with variables
System.out.println("You have "+variable+" points");
Example 3: java variable in string
String string = String.format("A string %s", aVariable);