Commit d395e840 authored by stephanie.smith's avatar stephanie.smith

initial

parents
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
## Getting Started
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
## Folder Structure
The workspace contains two folders by default, where:
- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
import java.util.ArrayList;
public class Animal {
public static void main(String[] args) {
ArrayList<String>animalList=new ArrayList<String>();
animalList.add("deer");
animalList.add("monkey");
animalList.add("eagle");
animalList.add("parrot");
animalList.add("guppy");
animalList.add("blobfish");
animalList.add("crocodile");
animalList.add("lizard");
//print a list of all animals in zoo
for(String i:animalList){
System.out.println("list of animals: ");
System.out.println(i);
}
//print animal species
//mammal
ArrayList<String>mammalList=new ArrayList<String>();
mammalList.add("deer");
mammalList.add("monkey");
System.out.println("All mammals in zoo:");
for(String i:mammalList){
System.out.println(i);
}
//bird
ArrayList<String>birdList=new ArrayList<String>();
birdList.add("eagle");
birdList.add("parrot");
System.out.println("All birds in zoo:");
for(String i:birdList){
System.out.println(i);
}
//fish
ArrayList<String>fishList=new ArrayList<String>();
fishList.add("guppy");
fishList.add("blobfish");
System.out.println("All fish in zoo:");
for(String i:fishList){
System.out.println(i);
}
//reptiles
ArrayList<String>reptileList=new ArrayList<String>();
reptileList.add("lizard");
reptileList.add("crocidile");
System.out.println("All reptiles in zoo:");
for(String i:reptileList){
System.out.println(i);
}
//print environments
//jungle
ArrayList<String>jungle=new ArrayList<String>();
jungle.add("parrot");
jungle.add("monkey");
jungle.add("crocodile");
jungle.add("lizard");
System.out.println("All animals in the jungle:");
for(String i:jungle){
System.out.println(i);
}
//forest
ArrayList<String>forest=new ArrayList<String>();
forest.add("eagle");
forest.add("deer");
System.out.println("All animals in the forest:");
for(String i:forest){
System.out.println(i);
}
//aquarium
ArrayList<String>aquarium=new ArrayList<String>();
aquarium.add("guppy");
aquarium.add("blobfish");
System.out.println("All animals in the aquarium:");
for(String i:aquarium){
System.out.println(i);
}
//displaying food types
//kibble
ArrayList<String>kibble=new ArrayList<String>();
kibble.add("deer");
kibble.add("lizard");
System.out.println("Animals that eat kibble:");
for(String i:kibble){
System.out.println(i);
}
//fishfood
ArrayList<String>fishfood=new ArrayList<String>();
fishfood.add("guppy");
fishfood.add("blobfish");
System.out.println("Animals that eat fish food:");
for(String i:fishfood){
System.out.println(i);
}
//fruit
ArrayList<String>fruit=new ArrayList<String>();
fruit.add("monkey");
fruit.add("parrot");
System.out.println("Animals that eat fruit:");
for(String i:fruit){
System.out.println(i);
}
//meat
ArrayList<String>meat=new ArrayList<String>();
meat.add("eagle");
meat.add("crocodile");
System.out.println("Animals that eat meat:");
for(String i:meat){
System.out.println(i);
}
//details of one animal
System.out.println("Crocodile is a retile that eats meat and lives in the jungle.");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment