Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.IOException;

import java.io.ObjectInputStream;

public class Main {
    public static Object getObjectFromFile(String filePath) {
        FileInputStream freader;
        Object ret = null;
        try {
            freader = new FileInputStream(filePath);
            ObjectInputStream objectInputStream = new ObjectInputStream(freader);
            ret = objectInputStream.readObject();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block   
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block   
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block   
            e.printStackTrace();
        }
        return ret;
    }
}