how to print an arraylist with objects

I am trying to print an arraylist that contains different objects, but I cannot do it right, because I am very new to java.

This is my code:

This is what I have tried.

class ST {

String name;

String email;

int code;

//constructor

public ST(String name, String email, int code) {

this.name = name;

this.email = email;

this.code = codeSequence.incrementAndGet(); //Atomically increments by one the current value.

}

//getters +setters

}

//the main class

public class JavaApplication1 extends ST{

static ArrayList array = new ArrayList (); //T for Ticket( Generic Type)

static AtomicInteger codeSequence = new AtomicInteger(); //Creates a new AtomicInteger with initial value 0

public JavaApplication1(String...

Read More »

By: StackOverFlow - 5 days ago

Related Posts