Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import myclass.Animal;
import javax.xml.bind.*;

public class Main {

    public static void main(String[] args) throws JAXBException {
        Animal tiger = new Animal();
        tiger.setType("A");
        tiger.setValue("Tiger");

        JAXBContext jaxbContext = JAXBContext.newInstance(Animal.class);
        Marshaller m = jaxbContext.createMarshaller();
        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        m.marshal(tiger, System.out);
    }
}