Commit 2eef33ba authored by aurian.foulner's avatar aurian.foulner

origin

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;
import java.util.Scanner;
public class Animal {
public static void main(String[] args) throws Exception {
ArrayList <String> animals = new ArrayList <String> ();
animals.add("Bat");
animals.add("Donkey");
animals.add("Angelfish");
animals.add("Carp");
animals.add("Emu");
animals.add("Penguin");
animals.add("Snake");
animals.add("Lizard");
for (String x:animals){
System.out.println("Animals in a list: " + x);
}
ArrayList <String> mammals = new ArrayList <String>();
mammals.add("Bat");
mammals.add("Donkey");
ArrayList <String> reptiles = new ArrayList <String>();
reptiles.add("Snake");
reptiles.add("Lizard");
ArrayList <String> fish = new ArrayList <String>();
fish.add("Angelfish");
fish.add("Carp");
ArrayList <String> bird = new ArrayList <String>();
bird.add("Emu");
bird.add("Penguin");
try (Scanner sc = new Scanner (System.in)) {
System.out.println("Which classification would you like to be displayed?");
String str = sc.nextLine();
if (str == "Mammals"){
System.out.print(mammals);
}
else if (str == "Reptiles"){
System.out.print(reptiles);
}
else if (str == "Fish"){
System.out.print(fish);
}
else if (str == "Bird"){
System.out.print(bird);
}
}
}
}
File added
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