Array declared and initialized in one line.
This commit is contained in:
parent
c2d37e99e1
commit
1d94492e29
|
@ -8,16 +8,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
public class ThymeleafArrayController {
|
public class ThymeleafArrayController {
|
||||||
@GetMapping("/arrays")
|
@GetMapping("/arrays")
|
||||||
public String arrayController(Model model) {
|
public String arrayController(Model model) {
|
||||||
String[] continents = new String[7];
|
String[] continents = {"Africa", "Antarctica", "Asia", "Australia", "Europe", "North America", "Sourth America"};
|
||||||
|
|
||||||
continents[0] = "Africa";
|
|
||||||
continents[1] = "Antarctica";
|
|
||||||
continents[2] = "Assia";
|
|
||||||
continents[3] = "Australia";
|
|
||||||
continents[4] = "Europe";
|
|
||||||
continents[5] = "North America";
|
|
||||||
continents[6] = "Sourth America";
|
|
||||||
|
|
||||||
model.addAttribute("continents", continents);
|
model.addAttribute("continents", continents);
|
||||||
|
|
||||||
return "continents";
|
return "continents";
|
||||||
|
|
Loading…
Reference in New Issue