Created
October 4, 2017 18:01
-
-
Save yusufcakal/1a92caa6c3d196bb03223cd6cc27d4d5 to your computer and use it in GitHub Desktop.
Medium Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import pojo.Job; | |
import pojo.User; | |
public class Main { | |
public static void main(String[] args) { | |
User user = new User(1,"Yusuf","yusufcakal","123456"); | |
Job job = new Job("Computer Science", "Engineer"); | |
user.setJob(job); | |
try { | |
JAXBContext jaxbContext = JAXBContext.newInstance(User.class); | |
Marshaller marshaller = jaxbContext.createMarshaller(); | |
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //Çıktının formatlı olmasını istiyoruz. | |
marshaller.marshal(user, System.out); | |
} catch (JAXBException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment