-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHelloWorld.java
More file actions
31 lines (27 loc) · 880 Bytes
/
Copy pathHelloWorld.java
File metadata and controls
31 lines (27 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package simpleJava;
import java.util.ArrayList;
/**
* HelloWorld
*/
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, this is java from vs code");
System.out.println(getString());
System.out.println(getObject().toString());
}
static String getString() {
return "A message from method";
}
static ArrayList<Animal> getObject() {
Animal animal1 = new Animal("Lion", "Africa");
Animal animal2 = new Animal("Zebra", "Africa");
Animal animal3 = new Animal("Kangaroo", "Australia");
ArrayList<Animal> animals = new ArrayList<Animal>();
animals.add(animal1);
animals.add(animal2);
animals.add(animal3);
return animals;
// Animal animal = new Animal("Lion", "Africa");
// return animal.toString();
}
}