string = new string java code example

Example 1: java variable in string

String string = String.format("A string %s", aVariable);

Example 2: how to make a string java

String newString = "Hello World";

Example 3: java new string with values

new String[]{"day", "week", "month"}

Example 4: how to make a string in java

//In Javascript, a string is declared using double quotes "". It is made up by character values.
//For eg:
string = "hello".

Example 5: String... java

//Object... (here String...) means that you can give
//in parameter one or many objects of same type

func();

func("arg1", "arg2", "arg3");

String[] args = new String[]{"arg1", "arg2", "arg3"}
func(args);

void func(String... args);