If you mean the time the customer was created then load your customer out of the queue into a variable then call cust.getTime() to get the creation time. Like this:
Customer cust = custQ.peek();
cust.getTime();
If you mean how to get the time when the main method ends or returns. simply place System.currentTimeMillis(); at the end of the main method. You can even return the value to the caller if you like.
return System.currentTimeMillis();
Im sorry I had to guess at what you ment if neither of those is what you ment describe what you want in more detail and ill try to answer your question.
In response to your earlier post.
Are you assigning each customer a number and you want to find the max of those numbers or do you want to find the number of customers in the queue?
The first is realy easy simply add a variable to your customer class and make it static every time you create a new customer compair the value stored in the variable to the customer' number if the customer's number is greator set the value to the customer's number.
So your customer class would look like:
public class Customer{
private static int max = 0; //im assuming you only assign positive integers to your customers
//making the variable static means there will only be one of it no matter how many instances of this class you create
private int time; //where as there will be one of this variable for every instance of customer
public Customer(int number){ //your constructor to create object instances
if(number > max)
max = number;// set max to largest number
time = System.currentTimeMillis(); //save the current system time if you want a date and hour look up the date class.
}
public int getTime(){ //returns the creation time of the object.
return time;
}
}
the second is simply custQ.size()