O que tem de errado com meu código ? (vetor)

package Meuscodigos;

import java.io.*;

class Vetor{

private Object lista[];
private int primeiro, ultimo,posicao;
private String nome;


public Vetor( int tamanhoMaximo){
	
	this.lista = new Object[tamanhoMaximo];
	this.posicao = (-1);
	this.primeiro = 0;
	this.ultimo = this.primeiro;	
	
}

public Vetor(){
	
}

public void insere(Object x)throws Exception{
	
	if(this.ultimo>= this.lista.length){
		throw new Exception("Erro: A lista esta cheia");
	}else{
		this.lista[this.ultimo]=x;
		this.ultimo = this.ultimo+1;
	}
}

public boolean vazia(){
	
	return (this.primeiro == this.ultimo);
	
}

public Object pesquisa (Object chave){
	
	if(this.vazia()||chave == null)
		return null;
	
	
	for (int p =0;p <this.ultimo;p++)
		
		if(this.lista[p].equals(chave))
			return this.lista[p];
		
		return null;
	
	
}



public static void main(String[] args){
	
	Integer obj_int = new Integer(5);
	Vetor obj = new Vetor();
	
	obj.insere(obj_int);
	
	System.out.println(obj);
			
	
	
			
}

}

Acho que é pq vc não declarou o try catch:

try {
    Vetor obj = new Vetor();

    int obj_int = 5;
    obj.insere(obj_int);

    System.out.println(obj);
} catch(Exception e){
       e.printStackTrace();
}

Muito obirgado :slight_smile: